From 0a63569fd16354464df9b3e3629fb56c4f9b3c43 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Thu, 18 Aug 2016 10:06:27 +0200 Subject: [PATCH] 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 --- gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index ea13658..3341c98 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) { -- 2.7.4