[vlc-commits] stream_filter: dash: return lowest representation if none match bw
Francois Cartegnie
git at videolan.org
Thu Dec 18 22:39:51 CET 2014
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 27 12:27:11 2014 +0100| [78b1c0325e207d89f891fc2c6e886ce93686bec1] | committer: Francois Cartegnie
stream_filter: dash: return lowest representation if none match bw
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=78b1c0325e207d89f891fc2c6e886ce93686bec1
---
.../dash/adaptationlogic/Representationselectors.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp b/modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp
index fae06cb..517209b 100644
--- a/modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp
+++ b/modules/stream_filter/dash/adaptationlogic/Representationselectors.cpp
@@ -46,7 +46,11 @@ Representation * RepresentationSelector::select(Period *period, uint64_t bitrate
std::vector<Representation *> reps = (*adaptIt)->getRepresentations();
Representation *candidate = select(reps, (best)?best->getBandwidth():0, bitrate);
if (candidate)
+ {
+ if (candidate->getBandwidth() > bitrate) /* none matched, returned lowest */
+ return candidate;
best = candidate;
+ }
}
return best;
}
@@ -82,10 +86,13 @@ Representation * RepresentationSelector::select(Period *period, uint64_t bitrate
Representation * RepresentationSelector::select(std::vector<Representation *>& reps,
uint64_t minbitrate, uint64_t maxbitrate) const
{
- Representation *candidate = NULL;
+ Representation *candidate = NULL, *lowest = NULL;
std::vector<Representation *>::const_iterator repIt;
for(repIt=reps.begin(); repIt!=reps.end(); repIt++)
{
+ if ( !lowest || (*repIt)->getBandwidth() < lowest->getBandwidth())
+ lowest = *repIt;
+
if ( (*repIt)->getBandwidth() < maxbitrate &&
(*repIt)->getBandwidth() > minbitrate )
{
@@ -93,5 +100,9 @@ Representation * RepresentationSelector::select(std::vector<Representation *>& r
minbitrate = (*repIt)->getBandwidth();
}
}
+
+ if (!candidate)
+ return candidate = lowest;
+
return candidate;
}
More information about the vlc-commits
mailing list