]> git.sesse.net Git - vlc/commitdiff
stream_filter: dash: for now set adaptation interval
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 15 Dec 2014 15:43:48 +0000 (16:43 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 18 Dec 2014 20:23:51 +0000 (21:23 +0100)
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h

index a86785bcb4deb4c2f02ecda4cf77a8b71b049a44..38892904ee188143125c2e15f27c0bbb4c621f22 100644 (file)
@@ -36,7 +36,8 @@ using namespace dash::mpd;
 
 RateBasedAdaptationLogic::RateBasedAdaptationLogic  (MPD *mpd) :
                           AbstractAdaptationLogic   (mpd),
-                          bpsAvg(0), bpsSamplecount(0)
+                          bpsAvg(0), bpsSamplecount(0),
+                          currentBps(0)
 {
     width  = var_InheritInteger(mpd->getVLCObject(), "dash-prefwidth");
     height = var_InheritInteger(mpd->getVLCObject(), "dash-prefheight");
@@ -48,7 +49,7 @@ const Representation *RateBasedAdaptationLogic::getCurrentRepresentation(Streams
         return NULL;
 
     RepresentationSelector selector;
-    Representation *rep = selector.select(currentPeriod, type, bpsAvg, width, height);
+    Representation *rep = selector.select(currentPeriod, type, currentBps, width, height);
     if ( rep == NULL )
     {
         rep = selector.select(currentPeriod, type);
@@ -71,4 +72,7 @@ void RateBasedAdaptationLogic::updateDownloadRate(size_t size, mtime_t time)
         bpsAvg = bpsAvg - (bpsAvg - current) / (bpsSamplecount + 1);
 
     bpsSamplecount++;
+
+    if(bpsSamplecount % 5 == 0)
+        currentBps = bpsAvg;
 }
index dceb5f4eb1082539a22e1c0cee5fd96be5068ab5..a693accb4394d320a0a789d5dcc2e7b594754530 100644 (file)
@@ -46,6 +46,7 @@ namespace dash
                 int                     height;
                 size_t                  bpsAvg;
                 size_t                  bpsSamplecount;
+                size_t                  currentBps;
         };
     }
 }