[vlc-devel] [vlc-commits] commit: stream_filter/httplive.c: select stream with lowest bandwidth to start playback. (Jean-Paul Saman )

Kurle, Brian Brian.Kurle at arrisi.com
Mon Nov 29 18:12:19 CET 2010


Why are you downloading the lowest bandwidth?  In our production (and iOS devices) calculate to use the best fits right off the bat by downloading first segment of the highest and lowest streams to determine the best fit.   For production use, this will turn off companies (including ours).

-----Original Message-----
From: vlc-commits-bounces at videolan.org [mailto:vlc-commits-bounces at videolan.org] On Behalf Of git at videolan.org
Sent: Friday, November 26, 2010 7:55 AM
To: vlc-commits at videolan.org
Subject: [vlc-commits] commit: stream_filter/httplive.c: select stream with lowest bandwidth to start playback. (Jean-Paul Saman )

vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Nov 26 15:34:14 2010 +0100| [d20cd47813b732bba92eb3d2663f13aa89108576] | committer: Jean-Paul Saman 

stream_filter/httplive.c: select stream with lowest bandwidth to start playback.

Start playback with the lowest bandwidth stream.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d20cd47813b732bba92eb3d2663f13aa89108576
---

 modules/stream_filter/httplive.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 39d9fc2..0ff5ede 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -232,6 +232,29 @@ static hls_stream_t *hls_GetLast(vlc_array_t *hls_stream)
     return (hls_stream_t *) hls_Get(hls_stream, count);
 }
 
+static int hls_LowestBandwidthStream(vlc_array_t *hls_stream)
+{
+    int count = vlc_array_count(hls_stream);
+    int i_lowest = 0;
+    uint64_t lowest = 0;
+
+    for (int i = 0; i < count; i++)
+    {
+        hls_stream_t *hls = (hls_stream_t *) vlc_array_item_at_index(hls_stream, i);
+        if (lowest == 0)
+        {
+            lowest = hls->bandwidth;
+            i_lowest = i;
+        }
+        else if (hls->bandwidth < lowest)
+        {
+            lowest = hls->bandwidth;
+            i_lowest = i;
+        }
+    }
+    return i_lowest;
+}
+
 /* Segment */
 static segment_t *segment_New(hls_stream_t* hls, int duration, char *uri)
 {
@@ -1158,7 +1181,7 @@ static int Open(vlc_object_t *p_this)
     }
 
     /* */
-    int current = p_sys->current = 0;
+    int current = p_sys->current = hls_LowestBandwidthStream(p_sys->hls_stream);
     p_sys->segment = 0;
 
     if (Prefetch(s, &current) != VLC_SUCCESS)

_______________________________________________
vlc-commits mailing list
vlc-commits at videolan.org
http://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list