mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Fix Seeker.getTimeUs for positions before the first frame.
Issue: #1038 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=109906628
This commit is contained in:
parent
f37fcddfb0
commit
36ea0f8acd
2 changed files with 3 additions and 2 deletions
|
|
@ -47,7 +47,8 @@ import com.google.android.exoplayer.C;
|
|||
|
||||
@Override
|
||||
public long getTimeUs(long position) {
|
||||
return ((position - firstFramePosition) * C.MICROS_PER_SECOND * BITS_PER_BYTE) / bitrate;
|
||||
return (Math.max(0, position - firstFramePosition) * C.MICROS_PER_SECOND * BITS_PER_BYTE)
|
||||
/ bitrate;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ import com.google.android.exoplayer.util.Util;
|
|||
|
||||
@Override
|
||||
public long getTimeUs(long position) {
|
||||
if (!isSeekable()) {
|
||||
if (!isSeekable() || position < firstFramePosition) {
|
||||
return 0L;
|
||||
}
|
||||
double offsetByte = 256.0 * (position - firstFramePosition) / sizeBytes;
|
||||
|
|
|
|||
Loading…
Reference in a new issue