hlsdemux: Fix how the playlists are refreshed
authorSebastian Dröge <sebastian@centricular.com>
Thu, 23 Apr 2015 15:33:04 +0000 (17:33 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 23 Apr 2015 15:47:18 +0000 (17:47 +0200)
We should only refresh the currently selected variant playlist (if any,
otherwise the main playlist), not the main playlist. And only try to
refresh the main playlist if updating the variant playlist fails.

Some servers (Wowza) use the request of the main playlist to create a
"session", which is then part of the URI of the variant playlist and
also the fragments. Refreshing the main playlist would generate a new
session, and the server rate limits that usually. And after a few retries
the server just kicks us out.

Also as a side effect we now use the same downloader for all playlists, so
that we only have 2 instead of 3 connections to the server. And also
previously we just ignored the downloaded data from the main playlist that
the base class gave to us.

ext/hls/gsthlsdemux.c

index f9d353d..03d4f4e 100644 (file)
@@ -100,8 +100,7 @@ static gint64 gst_hls_demux_get_manifest_update_interval (GstAdaptiveDemux *
     demux);
 static gboolean gst_hls_demux_process_manifest (GstAdaptiveDemux * demux,
     GstBuffer * buf);
-static GstFlowReturn gst_hls_demux_update_manifest_data (GstAdaptiveDemux *
-    demux, GstBuffer * buf);
+static GstFlowReturn gst_hls_demux_update_manifest (GstAdaptiveDemux * demux);
 static gboolean gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek);
 static gboolean
 gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
@@ -186,8 +185,7 @@ gst_hls_demux_class_init (GstHLSDemuxClass * klass)
   adaptivedemux_class->get_manifest_update_interval =
       gst_hls_demux_get_manifest_update_interval;
   adaptivedemux_class->process_manifest = gst_hls_demux_process_manifest;
-  adaptivedemux_class->update_manifest_data =
-      gst_hls_demux_update_manifest_data;
+  adaptivedemux_class->update_manifest = gst_hls_demux_update_manifest;
   adaptivedemux_class->reset = gst_hls_demux_reset;
   adaptivedemux_class->seek = gst_hls_demux_seek;
   adaptivedemux_class->stream_has_next_fragment =
@@ -401,7 +399,7 @@ gst_hls_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
 }
 
 static GstFlowReturn
-gst_hls_demux_update_manifest_data (GstAdaptiveDemux * demux, GstBuffer * buf)
+gst_hls_demux_update_manifest (GstAdaptiveDemux * demux)
 {
   GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (demux);
   if (!gst_hls_demux_update_playlist (hlsdemux, TRUE, NULL))