summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2016-08-18 10:06:27 +0200
committerJan Schmidt <jan@centricular.com>2016-08-23 01:40:39 +1000
commit0a63569fd16354464df9b3e3629fb56c4f9b3c43 (patch)
tree9061d2be17694fb039646937586ce4b5166562c9
parent3550fb3a6a6a3738e278589f926a479b922c8cc4 (diff)
adaptivedemux: fix stream exposure condition
The new streams should not be exposed until all streams are done with the current fragment. The old code is incorrect and actually only checked the current stream. Fix this by properly checking all streams. Also, ignore the current stream. The code is only reached when the current stream finished downloading and since 07f49f15b1196cc9fa0d45af91149a35fce123b9 ("adaptivedemux: On EOS, handle it before waking download loop") download_finished is set after gst_adaptive_demux_stream_advance_fragment_unlocked() is called. Without this HLS playback with multiple streams is broken, because the new streams are never exposed. https://bugzilla.gnome.org/show_bug.cgi?id=770075
-rw-r--r--gst-libs/gst/adaptivedemux/gstadaptivedemux.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
index ea1365896..3341c98a3 100644
--- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ -3677,10 +3677,13 @@ gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux,
for (iter = demux->streams; iter; iter = g_list_next (iter)) {
/* Only expose if all streams are now cancelled or finished downloading */
- g_mutex_lock (&stream->fragment_download_lock);
- can_expose &= (stream->cancelled == TRUE
- || stream->download_finished == TRUE);
- g_mutex_unlock (&stream->fragment_download_lock);
+ GstAdaptiveDemuxStream *other = iter->data;
+ if (other != stream) {
+ g_mutex_lock (&other->fragment_download_lock);
+ can_expose &= (other->cancelled == TRUE
+ || other->download_finished == TRUE);
+ g_mutex_unlock (&other->fragment_download_lock);
+ }
}
if (can_expose) {