Commit 38148b30 by andrewlewis Committed by Oliver Woodman

Fix Seeker.getTimeUs for positions before the first frame.

Issue: #1038
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=109906628
parent 99b34a12
......@@ -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;
......
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