mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-11-01 13:03:52 +08:00
dcaenc: cleanup on init failure and add a threadsafe init codec cap
The encoder didn't clean up if a malloc failed during init. It also doesn't need any external tables to be initialized on init. Finally, it didn't need to check for whether avctx->priv_data exists during uninit. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
This commit is contained in:
@@ -295,11 +295,10 @@ static int encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
static av_cold int encode_close(AVCodecContext *avctx)
|
static av_cold int encode_close(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
if (avctx->priv_data) {
|
DCAEncContext *c = avctx->priv_data;
|
||||||
DCAEncContext *c = avctx->priv_data;
|
subband_bufer_free(c);
|
||||||
subband_bufer_free(c);
|
ff_dcaadpcm_free(&c->adpcm_ctx);
|
||||||
ff_dcaadpcm_free(&c->adpcm_ctx);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1287,6 +1286,7 @@ AVCodec ff_dca_encoder = {
|
|||||||
.close = encode_close,
|
.close = encode_close,
|
||||||
.encode2 = encode_frame,
|
.encode2 = encode_frame,
|
||||||
.capabilities = AV_CODEC_CAP_EXPERIMENTAL,
|
.capabilities = AV_CODEC_CAP_EXPERIMENTAL,
|
||||||
|
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||||
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32,
|
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S32,
|
||||||
AV_SAMPLE_FMT_NONE },
|
AV_SAMPLE_FMT_NONE },
|
||||||
.supported_samplerates = sample_rates,
|
.supported_samplerates = sample_rates,
|
||||||
|
|||||||
Reference in New Issue
Block a user