hlsdemux: don't update the playlist if we stay in the same bitrate
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Sat, 12 Mar 2011 12:15:52 +0000 (13:15 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 30 Mar 2011 07:19:23 +0000 (09:19 +0200)
gst/hls/gsthlsdemux.c

index 20900a5a7e1c8cfa103cf47cc50b0981acc75ccf..b9235ec6a290e01a90fbc848c815b2589be8a933 100644 (file)
@@ -848,15 +848,18 @@ gst_hls_demux_update_playlist (GstHLSDemux * demux, gboolean retry)
 static gboolean
 gst_hls_demux_change_playlist (GstHLSDemux * demux, gboolean is_fast)
 {
-  if (is_fast) {
-    if (!demux->client->main->lists->next)
-      return TRUE;
-    demux->client->main->lists = g_list_next (demux->client->main->lists);
-  } else {
-    if (!demux->client->main->lists->prev)
-      return TRUE;
-    demux->client->main->lists = g_list_previous (demux->client->main->lists);
-  }
+  GList *list;
+
+  if (is_fast)
+    list = g_list_next (demux->client->main->lists);
+  else
+    list = g_list_previous (demux->client->main->lists);
+
+  /* Don't do anything else if the playlist is the same */
+  if (!list || list->data == demux->client->current)
+    return TRUE;
+
+  demux->client->main->lists = list;
 
   gst_m3u8_client_set_current (demux->client, demux->client->main->lists->data);
   gst_hls_demux_update_playlist (demux, TRUE);