[vlc-commits] stream_filter: dash: for now set adaptation interval

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:55 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 15 16:43:48 2014 +0100| [33d200ee539979eeb1394ac0350fa578efec8bd3] | committer: Francois Cartegnie

stream_filter: dash: for now set adaptation interval

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

 .../dash/adaptationlogic/RateBasedAdaptationLogic.cpp          |    8 ++++++--
 .../dash/adaptationlogic/RateBasedAdaptationLogic.h            |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
index a86785b..3889290 100644
--- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.cpp
@@ -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;
 }
diff --git a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
index dceb5f4..a693acc 100644
--- a/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
+++ b/modules/stream_filter/dash/adaptationlogic/RateBasedAdaptationLogic.h
@@ -46,6 +46,7 @@ namespace dash
                 int                     height;
                 size_t                  bpsAvg;
                 size_t                  bpsSamplecount;
+                size_t                  currentBps;
         };
     }
 }



More information about the vlc-commits mailing list