Hi,
I tried to call av_register_all() multiple times, and it works well
for old lib version, but now it will cause the following call to
avformat_open_input() stuck forever.
After examining the code for libavformat, I found that there was
a code change about Mar, 2017 that changed av_register_all()
to use pthread_once(), and it seems that the guarding variable
for once-control failed to protect register_all() to be called
multiple times. Refer to the following code:
void av_register_all(void)
{
AVOnce control = AV_ONCE_INIT;
ff_thread_once(&control, register_all);
}
Should it be a static or a global variable here?
The reason it will cause avformat_open_input() to be stuck
forever is that each time register_all() is called,
ff_register_rtp_dynamic_payload_handlers() will also be called.
It will cause the linked list rtp_first_dynamic_payload_handler
to become a loop. When we call avformat_open_input() it will
try to find the rtp handler in this linked list, and if unfortunately
there is no matched handler in the list, it will loop forever.
Thanks!
Yuan Yi
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user