diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-08-18 09:09:55 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-08-18 09:09:55 +0200 |
commit | e721cb8d8b5c64c4d9786928f6c629cb93611d74 (patch) | |
tree | 9e12cc763fb36c11a1a6c170dd1cb6cb4bd2a585 /libavcodec/libfdk-aacdec.c | |
parent | 4cf4831ae7e2b6ccbea9c2d65605a3722aeac9c2 (diff) | |
parent | f34b152eb7b7e8d2aee57c710a072cf74173fbe1 (diff) | |
download | ffmpeg-e721cb8d8b5c64c4d9786928f6c629cb93611d74.tar.gz |
Merge commit 'f34b152eb7b7e8d2aee57c710a072cf74173fbe1'
* commit 'f34b152eb7b7e8d2aee57c710a072cf74173fbe1':
libfdk-aacdec: Clean up properly if the init fails
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec/libfdk-aacdec.c')
-rw-r--r-- | libavcodec/libfdk-aacdec.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index c25bd5e737..420d91f222 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -256,13 +256,11 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE); if (!s->anc_buffer) { av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n"); - ret = AVERROR(ENOMEM); - goto fail; + return AVERROR(ENOMEM); } if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) { av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n"); - ret = AVERROR_UNKNOWN; - goto fail; + return AVERROR_UNKNOWN; } } } @@ -307,15 +305,10 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS; s->decoder_buffer = av_malloc(s->decoder_buffer_size); - if (!s->decoder_buffer) { - ret = AVERROR(ENOMEM); - goto fail; - } + if (!s->decoder_buffer) + return AVERROR(ENOMEM); return 0; -fail: - fdk_aac_decode_close(avctx); - return ret; } static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, @@ -388,4 +381,6 @@ AVCodec ff_libfdk_aac_decoder = { .flush = fdk_aac_decode_flush, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .priv_class = &fdk_aac_dec_class, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | + FF_CODEC_CAP_INIT_CLEANUP, }; |