mirror of
https://github.com/androidx/media.git
synced 2025-05-21 23:56:32 +08: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
99b34a1287
commit
38148b303f
@ -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…
x
Reference in New Issue
Block a user