[vlc-commits] stream_filter: dash: simplify getBestRepresentation

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Nov 18 16:20:01 2014 +0100| [80706d9770ea6432d5ac8a420295c9aa6031059f] | committer: Francois Cartegnie

stream_filter: dash: simplify getBestRepresentation

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

 modules/stream_filter/dash/mpd/IMPDManager.cpp |   25 ++----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/modules/stream_filter/dash/mpd/IMPDManager.cpp b/modules/stream_filter/dash/mpd/IMPDManager.cpp
index 8b2d09a..ac91b13 100644
--- a/modules/stream_filter/dash/mpd/IMPDManager.cpp
+++ b/modules/stream_filter/dash/mpd/IMPDManager.cpp
@@ -22,6 +22,7 @@
 #endif
 
 #include "IMPDManager.h"
+#include <limits>
 
 using namespace dash::mpd;
 
@@ -71,29 +72,7 @@ const MPD* IMPDManager::getMPD() const
 
 Representation* IMPDManager::getBestRepresentation(Period *period) const
 {
-    if (period == NULL)
-        return NULL;
-
-    std::vector<AdaptationSet *> adaptSet = period->getAdaptationSets();
-
-    uint64_t        bitrate  = 0;
-    Representation  *best    = NULL;
-
-    for(size_t i = 0; i < adaptSet.size(); i++)
-    {
-        std::vector<Representation *> reps = adaptSet.at(i)->getRepresentations();
-        for(size_t j = 0; j < reps.size(); j++)
-        {
-            uint64_t currentBitrate = reps.at(j)->getBandwidth();
-
-            if( currentBitrate > bitrate)
-            {
-                bitrate = currentBitrate;
-                best    = reps.at(j);
-            }
-        }
-    }
-    return best;
+    return getRepresentation(period, std::numeric_limits<uint64_t>::max());
 }
 
 Representation* IMPDManager::getRepresentation(Period *period, uint64_t bitrate ) const



More information about the vlc-commits mailing list