[vlc-commits] demux: adaptive: fix overflow computing bps remains
Francois Cartegnie
git at videolan.org
Wed Apr 19 10:59:56 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 18 17:15:20 2017 +0200| [f41c5bb5f4cc52158aef1543a677b83165dbb15f] | committer: Francois Cartegnie
demux: adaptive: fix overflow computing bps remains
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f41c5bb5f4cc52158aef1543a677b83165dbb15f
---
modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
index 1bfbe984a8..a209d63c33 100644
--- a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
@@ -168,10 +168,13 @@ void PredictiveAdaptationLogic::updateDownloadRate(const ID &id, size_t dlsize,
unsigned PredictiveAdaptationLogic::getAvailableBw(unsigned i_bw, const BaseRepresentation *curRep) const
{
unsigned i_remain = i_bw;
- i_remain -= usedBps;
+ if(i_remain > usedBps)
+ i_remain -= usedBps;
+ else
+ i_remain = 0;
if(curRep)
i_remain += curRep->getBandwidth();
- return i_remain;
+ return i_remain > i_bw ? i_remain : i_bw;
}
void PredictiveAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
More information about the vlc-commits
mailing list