From 505d4de064aff879674d0670cf1c96ca46545da3 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Thu, 3 Dec 2020 02:57:18 +0100 Subject: avcodec/[e]ac3enc: Make encoders init-threadsafe, fix race ff_eac3_exponent_init() set values twice when initializing a static table; ergo the initialization code must not run concurrently with a running EAC-3 encoder. Yet this code is executed every time an EAC-3 encoder is initialized. So use ff_thread_once() for this and also for a similar initialization performed for all AC-3 encoders to make them all init-threadsafe. Signed-off-by: Andreas Rheinhardt --- libavcodec/ac3enc_float.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec/ac3enc_float.c') diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c index 99863a9722..571f603182 100644 --- a/libavcodec/ac3enc_float.c +++ b/libavcodec/ac3enc_float.c @@ -153,5 +153,5 @@ AVCodec ff_ac3_encoder = { .supported_samplerates = ff_ac3_sample_rate_tab, .channel_layouts = ff_ac3_channel_layouts, .defaults = ac3_defaults, - .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; -- cgit v1.2.3