Commit 3f47da1f by tonihei

Reset readingPositionUs in BaseRenderer.enable

This does currently only happen by chance in replaceStream (called from
enable) if the stream previosly played read until C.TIME_END_OF_SOURCE.

enable already makes all changes done in resetPosition (except resetting
the reading position), so it's less error-prone and makes the intention
clearer if the same code is called from both enable and resetPosition.

The effect of this bug was quite limited because the numerical value
of readingPositionUs was only relevant for periods with changing
durations and server-side inserted ads.

PiperOrigin-RevId: 422300690
parent d0c13733
......@@ -99,10 +99,9 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
Assertions.checkState(state == STATE_DISABLED);
this.configuration = configuration;
state = STATE_ENABLED;
lastResetPositionUs = positionUs;
onEnabled(joining, mayRenderStartOfStream);
replaceStream(formats, stream, startPositionUs, offsetUs);
onPositionReset(positionUs, joining);
resetPosition(positionUs, joining);
}
@Override
......@@ -159,10 +158,14 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
@Override
public final void resetPosition(long positionUs) throws ExoPlaybackException {
resetPosition(positionUs, /* joining= */ false);
}
private void resetPosition(long positionUs, boolean joining) throws ExoPlaybackException {
streamIsFinal = false;
lastResetPositionUs = positionUs;
readingPositionUs = positionUs;
onPositionReset(positionUs, false);
onPositionReset(positionUs, joining);
}
@Override
......
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