summaryrefslogtreecommitdiff
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2015-11-27 14:52:35 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2015-11-27 14:52:35 +0000
commit3d62e7a30fa552be52d12b31e3e0f79153aff891 (patch)
tree0aca26f2b4029afb989bee72c27c10f14a3c9405 /libavcodec/aacenc.c
parent8000d484b83aafa752d84fbdbfb352ffe0dc64f8 (diff)
aacenc: make threadsafe
Since the ff_aac_tableinit() can be called by both the encoder and the decoder (in case of transcoding) this commit shares the AVOnce variable to prevent this. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index ca6c9dde07..d6cac47f62 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -986,7 +986,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
if (HAVE_MIPSDSPR1)
ff_aac_coder_init_mips(s);
- ff_aac_tableinit();
+ if ((ret = ff_thread_once(&aac_table_init, &ff_aac_tableinit)) != 0)
+ return AVERROR_UNKNOWN;
ff_af_queue_init(avctx, &s->afq);
@@ -1029,6 +1030,7 @@ AVCodec ff_aac_encoder = {
.encode2 = aac_encode_frame,
.close = aac_encode_end,
.supported_samplerates = mpeg4audio_sample_rates,
+ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_EXPERIMENTAL,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP,