Commit 1316445c 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 90c62f63
...@@ -323,10 +323,10 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -323,10 +323,10 @@ import java.util.concurrent.CopyOnWriteArraySet;
if (timeline.isEmpty()) { if (timeline.isEmpty()) {
return 0; return 0;
} }
long bufferedPosition = getBufferedPosition(); long position = getBufferedPosition();
long duration = getDuration(); long duration = getDuration();
return (bufferedPosition == C.TIME_UNSET || duration == C.TIME_UNSET) ? 0 return position == C.TIME_UNSET || duration == C.TIME_UNSET ? 0
: (int) (duration == 0 ? 100 : (bufferedPosition * 100) / duration); : (duration == 0 ? 100 : Util.constrainValue((int) ((position * 100) / duration), 0, 100));
} }
@Override @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