mirror of
https://github.com/androidx/media.git
synced 2025-05-04 22:20:47 +08:00
Constraint buffered percentage to [0,100]
Issue: #2902 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=158142754
This commit is contained in:
parent
643083194d
commit
1ac8420b7f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user