Commit 1ac8420b by olly Committed by Oliver Woodman

Constraint buffered percentage to [0,100]

Issue: #2902

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158142754
parent 64308319
......@@ -305,10 +305,10 @@ import java.util.concurrent.CopyOnWriteArraySet;
if (timeline.isEmpty()) {
return 0;
}
long bufferedPosition = getBufferedPosition();
long position = getBufferedPosition();
long duration = getDuration();
return (bufferedPosition == C.TIME_UNSET || duration == C.TIME_UNSET) ? 0
: (int) (duration == 0 ? 100 : (bufferedPosition * 100) / duration);
return position == C.TIME_UNSET || duration == C.TIME_UNSET ? 0
: (duration == 0 ? 100 : Util.constrainValue((int) ((position * 100) / duration), 0, 100));
}
@Override
......
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 sign in to comment