[vlc-commits] commit: stream_filter/httplive.c: HLS streams are in no particular order in the .m3u8 file (Jean-Paul Saman )

git at videolan.org git at videolan.org
Thu Dec 2 10:59:53 CET 2010


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Dec  1 14:01:47 2010 +0100| [4e8e992bf0634077156a7a743cd6f8c2844a7b7b] | committer: Jean-Paul Saman 

stream_filter/httplive.c: HLS streams are in no particular order in the .m3u8 file

Take into account that HLS streams with bandwidth specified are not in ascending
(or descending) order. Choose really the best wrt to measurements.

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

 modules/stream_filter/httplive.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index d2b4ad9..e984dd1 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -825,6 +825,7 @@ static int BandwidthAdaptation(stream_t *s, int progid, uint64_t *bandwidth)
     stream_sys_t *p_sys = s->p_sys;
     int candidate = -1;
     uint64_t bw = *bandwidth;
+    uint64_t bw_candidate = 0;
 
     int count = vlc_array_count(p_sys->hls_stream);
     for (int n = 0; n < count; n++)
@@ -836,15 +837,16 @@ static int BandwidthAdaptation(stream_t *s, int progid, uint64_t *bandwidth)
         /* only consider streams with the same PROGRAM-ID */
         if (hls->id == progid)
         {
-            if (bw >= hls->bandwidth)
+            if ((bw >= hls->bandwidth) && (bw_candidate < hls->bandwidth))
             {
                 msg_Dbg(s, "candidate %d bandwidth (bits/s) %"PRIu64" >= %"PRIu64,
                          n, bw, hls->bandwidth); /* bits / s */
-                *bandwidth = hls->bandwidth;
+                bw_candidate = hls->bandwidth;
                 candidate = n; /* possible candidate */
             }
         }
     }
+    *bandwidth = bw_candidate;
     return candidate;
 }
 



More information about the vlc-commits mailing list