Commit 80706d97 authored by François Cartegnie's avatar François Cartegnie 🤞

stream_filter: dash: simplify getBestRepresentation

parent 1134fcdf
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment