mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-03 05:10:03 +02:00
avformat/allformats: Making av_register_all() thread-safe.
When multiple threads tries to call av_register_all(), the first thread sets
initialized to 1 and do the register process. At the same time, other thread might
also call av_register_all(), which returns immediately because initialized is set to 1
(even when it has not completed registering codecs). We can avoid this problem
if we set initialised to 1 while exiting from function.
Github: Closes #196
(cherry picked from commit b092ee701f
)
Conflicts:
libavformat/allformats.c
This commit is contained in:
parent
b62191f9c1
commit
f3c1a76ffd
@ -54,7 +54,6 @@ void av_register_all(void)
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = 1;
|
||||
|
||||
avcodec_register_all();
|
||||
|
||||
@ -418,4 +417,6 @@ void av_register_all(void)
|
||||
REGISTER_PROTOCOL(LIBRTMPTE, librtmpte);
|
||||
REGISTER_PROTOCOL(LIBSSH, libssh);
|
||||
REGISTER_PROTOCOL(LIBSMBCLIENT, libsmbclient);
|
||||
|
||||
initialized = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user