mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Constraint seeks within bounds for ConstantBitrateSeeker
We do this everywhere for index based seeking already. Issue: #2876 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157568788
This commit is contained in:
parent
854c8d0381
commit
c80b60f4ac
1 changed files with 6 additions and 2 deletions
|
|
@ -16,6 +16,7 @@
|
|||
package com.google.android.exoplayer2.extractor.mp3;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
|
||||
/**
|
||||
* MP3 seeker that doesn't rely on metadata and seeks assuming the source has a constant bitrate.
|
||||
|
|
@ -41,8 +42,11 @@ import com.google.android.exoplayer2.C;
|
|||
|
||||
@Override
|
||||
public long getPosition(long timeUs) {
|
||||
return durationUs == C.TIME_UNSET ? 0
|
||||
: firstFramePosition + (timeUs * bitrate) / (C.MICROS_PER_SECOND * BITS_PER_BYTE);
|
||||
if (durationUs == C.TIME_UNSET) {
|
||||
return 0;
|
||||
}
|
||||
timeUs = Util.constrainValue(timeUs, 0, durationUs);
|
||||
return firstFramePosition + (timeUs * bitrate) / (C.MICROS_PER_SECOND * BITS_PER_BYTE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue