1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-20 07:48:15 +02:00
FFmpeg/libavcodec
Andreas Rheinhardt b7d4a08f0d avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Commit 1af615683e4a1a858407afbaa2fd686842da7e49 put initializing
the ff_fft_offsets_lut (which is typically used if FFT_FIXED_32)
behind an ff_thread_once() to make ff_fft_init() thread-safe; yet
there is a second place where said table may be initialized which
is not guarded by this AVOnce: ff_fft_init_mips(). MIPS uses this LUT
even for ordinary floating point FFTs, so that ff_fft_init() is not
thread-safe (on MIPS) for both 32bit fixed-point as well as
floating-point FFTs; e.g. ff_mdct_init() inherits this flaw and
therefore initializing e.g. the AAC decoders is not thread-safe (on
MIPS) despite them having FF_CODEC_CAP_INIT_CLEANUP set.

This commit fixes this by moving the AVOnce to fft_init_table.c and
using it to guard all initializations of ff_fft_offsets_lut.

(It is not that bad in practice, because every entry of
ff_fft_offsets_lut is never read during initialization and is only once
ever written to (namely to its final value); but even these are
conflicting actions which are (by definition) data races and lead to
undefined behaviour.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit b9c1ab89078d862e0146c9d7ed277addd770e3a3)
2021-02-27 07:20:59 +01:00
..
2020-02-07 13:36:57 -03:00
2020-05-27 22:13:39 +02:00
2021-02-02 14:18:21 +01:00
2019-06-26 21:25:10 +02:00
2021-02-02 14:18:21 +01:00
2020-05-30 18:02:55 +02:00
2020-05-30 18:02:55 +02:00
2019-08-11 19:13:21 +02:00
2020-03-12 20:26:48 +00:00
2020-03-12 20:26:48 +00:00
2020-05-21 09:31:08 +02:00
2019-11-13 09:08:43 -08:00
2020-02-22 00:15:43 +01:00
2021-02-02 14:18:21 +01:00
2019-12-05 20:20:05 +01:00
2020-03-22 11:55:44 -03:00
2020-04-26 18:38:25 +01:00
2020-03-17 16:07:25 +01:00
2020-06-05 18:14:17 +02:00
2020-06-14 22:02:34 +02:00
2019-08-29 21:04:54 +02:00
2019-06-29 19:22:19 +02:00
2020-04-26 18:38:25 +01:00
2019-08-11 19:13:21 +02:00
2019-12-10 16:09:14 +01:00
2020-01-11 23:31:18 +01:00
2021-02-02 14:18:21 +01:00
2021-02-20 14:21:24 +01:00
2020-05-19 20:09:25 +02:00
2020-05-12 01:00:28 +02:00
2019-09-02 13:46:11 -07:00
2020-05-26 10:52:12 +01:00
2020-05-26 10:52:12 +01:00
2020-05-26 10:52:12 +01:00
2020-06-14 22:02:34 +02:00
2020-06-08 20:45:56 +02:00
2020-05-30 18:02:55 +02:00
2020-07-09 12:35:39 +02:00
2019-10-22 10:51:42 +08:00
2020-02-19 22:37:30 +01:00
2020-04-26 18:38:25 +01:00
2020-01-30 19:57:25 +01:00
2019-08-23 22:24:07 +02:00
2020-04-04 23:26:15 +02:00
2020-05-22 22:23:18 +02:00
2021-02-02 14:18:20 +01:00
2021-02-02 14:18:20 +01:00
2021-02-02 14:18:20 +01:00
2020-01-13 23:26:25 +00:00
2019-11-09 17:59:03 +01:00
2020-06-08 01:22:34 +02:00
2020-01-11 23:31:18 +01:00
2020-04-26 18:38:25 +01:00
2021-02-27 07:20:58 +01:00
2019-06-12 20:06:20 +10:00
2019-10-25 00:22:33 +02:00
2019-08-22 18:35:44 +02:00
2019-09-05 19:45:53 +02:00
2020-04-16 15:05:07 -03:00
2020-03-22 11:55:44 -03:00
2020-05-23 07:07:36 +02:00