GNOME Bugzilla – Bug 756556
adaptivedemux: hang if application quits just after start
Last modified: 2015-10-29 11:23:37 UTC
Created attachment 313248 [details]
gdb stack trace, when application hangs
I am playing HLS bipbop stream (https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8)
Sometimes, if application tries to quit just at start of playback, it hangs.
Attached is gdb stack trace
This looks like a race between below two threads:
application goes to clean up resources, calling
gstadaptivedemux.c: gst_adaptive_demux_change_state ()
and thread downloading the segments:
which leads to resetting of variables: stream->demux->cancelled & stream->download_finished and thus the hang.
*** Bug 756619 has been marked as a duplicate of this bug. ***
Another similar backtrace in bug #756619
bug https://bugzilla.gnome.org/show_bug.cgi?id=755169 will add support for thread safety in adaptive demux. Vincent has proposed a patch and I commented on it. I also proposed a patch that fixes all race conditions in adaptive demux. We need some maintainers to review those patches.
the problem here is that gst_adaptive_demux_stop_tasks sets demux->cancelled = TRUE without grabbing a lock, so the value is probably not reflected in other threads.
I cannot reproduce this with Florin's patch referenced above. cancelled is always protected by the download lock in that patch.
*** This bug has been marked as a duplicate of bug 755169 ***