]> git.sesse.net Git - ffmpeg/commit
avcodec/snow: Use ff_thread_once() in ff_snow_common_init()
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 1 Dec 2020 23:10:13 +0000 (00:10 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 10 Dec 2020 00:36:16 +0000 (01:36 +0100)
commit6a94afbd5bf4aa3ccab12f038e8bbae7ef3973c0
treeb4ae496edfcbeb083e928f7cb9c5c4c00bd7c7c8
parentbdfe51b44f01de89f794a307f0a59941bc0ec9fa
avcodec/snow: Use ff_thread_once() in ff_snow_common_init()

ff_snow_common_init() currently initializes static data every time it is
invoked; given that both the Snow encoder and decoder have the
FF_CODEC_CAP_INIT_THREADSAFE flag set, this can lead to data races (and
therefore undefined behaviour) even though all threads write the same
values. This commit fixes this by using ff_thread_once() for the
initializations.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/snow.c