]> git.sesse.net Git - ffmpeg/commit
avcodec/[e]ac3enc: Make encoders init-threadsafe, fix race
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 3 Dec 2020 01:57:18 +0000 (02:57 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 9 Jan 2021 03:06:31 +0000 (04:06 +0100)
commit505d4de064aff879674d0670cf1c96ca46545da3
treeff628be60c33104cdba788378f172f209c9d86ed
parent69aeba8a19ac2fa6e1c9bdfb19229b513f314bb1
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 <andreas.rheinhardt@gmail.com>
libavcodec/ac3enc.c
libavcodec/ac3enc_fixed.c
libavcodec/ac3enc_float.c
libavcodec/eac3enc.c