mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Don't offset the first period holder by the start position
If seek is called for a non-seekable period, when the period is prepared the start position will be updated from the seek position to zero. Because the start position is part of the renderer offset for the first loaded period holder, after the update the renderer offset start position and the new start position would no longer cancel out, leading to the player position being negative. The first period holder's renderer offset is the fixed base offset (60 seconds) plus its start position, but the start position is always subtracted. Avoid subtracting the start position for the first period holder so that when it changes there is no need to update the renderer offset. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162188133
This commit is contained in:
parent
508db5fd0a
commit
706d4e51fe
1 changed files with 3 additions and 2 deletions
|
|
@ -1326,7 +1326,7 @@ import java.io.IOException;
|
|||
}
|
||||
|
||||
long rendererPositionOffsetUs = loadingPeriodHolder == null
|
||||
? (info.startPositionUs + RENDERER_TIMESTAMP_OFFSET_US)
|
||||
? RENDERER_TIMESTAMP_OFFSET_US
|
||||
: (loadingPeriodHolder.getRendererOffset() + loadingPeriodHolder.info.durationUs);
|
||||
int holderIndex = loadingPeriodHolder == null ? 0 : loadingPeriodHolder.index + 1;
|
||||
Object uid = timeline.getPeriod(info.id.periodIndex, period, true).uid;
|
||||
|
|
@ -1515,7 +1515,8 @@ import java.io.IOException;
|
|||
}
|
||||
|
||||
public long getRendererOffset() {
|
||||
return rendererPositionOffsetUs - info.startPositionUs;
|
||||
return index == 0 ? rendererPositionOffsetUs
|
||||
: (rendererPositionOffsetUs - info.startPositionUs);
|
||||
}
|
||||
|
||||
public boolean isFullyBuffered() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue