From 69867f95e2dd53ba9542500db9efbc09f464c400 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sat, 15 Aug 2015 19:01:00 +0200 Subject: [PATCH] adaptivedemux: Actually wait for playlist update when requested There are several cases where a HLS server could temporarily have wrong fragments, or reconfigure the playlist. In those cases, when we get fragment download failures, we *really* want to wait a bit (for the next playlist update) before retrying to get fragments. Previously this method was first checking to see if there was next fragments (according to the previous manifest update) before waiting for the next update. The problem was that if that if there is a temporary failure on the server, that's uncorrelated to whether the manifest contains next fragments or not. --- gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 3065de4925..2ee90c9cb4 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -1645,6 +1645,9 @@ gst_adaptive_demux_stream_wait_manifest_update (GstAdaptiveDemux * demux, break; } + GST_DEBUG_OBJECT (demux, "No fragment left but live playlist, wait a bit"); + g_cond_wait (&demux->manifest_cond, GST_MANIFEST_GET_LOCK (demux)); + /* Got a new fragment or not live anymore? */ if (gst_adaptive_demux_stream_has_next_fragment (demux, stream)) { GST_DEBUG_OBJECT (demux, "new fragment available, " @@ -1659,9 +1662,6 @@ gst_adaptive_demux_stream_wait_manifest_update (GstAdaptiveDemux * demux, ret = FALSE; break; } - - GST_DEBUG_OBJECT (demux, "No fragment left but live playlist, wait a bit"); - g_cond_wait (&demux->manifest_cond, GST_MANIFEST_GET_LOCK (demux)); } GST_DEBUG_OBJECT (demux, "Retrying now"); return ret;