hlsdemux: Also refetch the playlist after the first fragment failure
authorSebastian Dröge <sebastian@centricular.com>
Mon, 15 Sep 2014 10:33:45 +0000 (13:33 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 15 Sep 2014 10:33:45 +0000 (13:33 +0300)
Previously we only refetched the playlist if downloading a fragment
has failed once. We should also do that if it failed a second or third time,
chances are that the playlist was updated now and contains new URIs.

ext/hls/gsthlsdemux.c

index 5809712..5dcb8bd 100644 (file)
@@ -1211,6 +1211,7 @@ gst_hls_demux_stream_loop (GstHLSDemux * demux)
             && !gst_m3u8_client_is_live (demux->client)
             && gst_hls_demux_update_playlist (demux, FALSE, &err)) {
           /* Retry immediately, the playlist actually has changed */
+          GST_DEBUG_OBJECT (demux, "Updated the playlist");
           return;
         } else {
           /* Wait half the fragment duration before retrying */
@@ -1231,6 +1232,12 @@ gst_hls_demux_stream_loop (GstHLSDemux * demux)
             demux->next_download);
         g_mutex_unlock (&demux->download_lock);
         GST_DEBUG_OBJECT (demux, "Retrying now");
+
+        /* Refetch the playlist now after we waited */
+        if (!gst_m3u8_client_is_live (demux->client)
+            && gst_hls_demux_update_playlist (demux, FALSE, &err)) {
+          GST_DEBUG_OBJECT (demux, "Updated the playlist");
+        }
         return;
       } else {
         GST_ELEMENT_ERROR_FROM_ERROR (demux,