summaryrefslogtreecommitdiffstats
path: root/libavcodec/dcaenc.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2018-01-13 18:03:42 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2018-01-13 18:06:59 +0000
commit56e11ebf55a5e51a8a7131d382c2020e35d34f42 (patch)
tree732d72fa628f918d34c5134820b5dca50f137d20 /libavcodec/dcaenc.c
parentc7d726f7f466f69af8321a5e01133e64b4885f53 (diff)
downloadffmpeg-streaming-56e11ebf55a5e51a8a7131d382c2020e35d34f42.zip
ffmpeg-streaming-56e11ebf55a5e51a8a7131d382c2020e35d34f42.tar.gz
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>
Diffstat (limited to 'libavcodec/dcaenc.c')
-rw-r--r--libavcodec/dcaenc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index dd601ff..7ba2346 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -295,11 +295,10 @@ static int encode_init(AVCodecContext *avctx)
static av_cold int encode_close(AVCodecContext *avctx)
{
- if (avctx->priv_data) {
- DCAEncContext *c = avctx->priv_data;
- subband_bufer_free(c);
- ff_dcaadpcm_free(&c->adpcm_ctx);
- }
+ DCAEncContext *c = avctx->priv_data;
+ subband_bufer_free(c);
+ ff_dcaadpcm_free(&c->adpcm_ctx);
+
return 0;
}
@@ -1287,6 +1286,7 @@ AVCodec ff_dca_encoder = {
.close = encode_close,
.encode2 = encode_frame,
.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,
AV_SAMPLE_FMT_NONE },
.supported_samplerates = sample_rates,
OpenPOWER on IntegriCloud