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
This commit is contained in:
parent
3c8a2c4e2e
commit
e98b846884
@ -103,10 +103,9 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
Assertions.checkState(state == STATE_DISABLED);
|
Assertions.checkState(state == STATE_DISABLED);
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
state = STATE_ENABLED;
|
state = STATE_ENABLED;
|
||||||
lastResetPositionUs = positionUs;
|
|
||||||
onEnabled(joining, mayRenderStartOfStream);
|
onEnabled(joining, mayRenderStartOfStream);
|
||||||
replaceStream(formats, stream, startPositionUs, offsetUs);
|
replaceStream(formats, stream, startPositionUs, offsetUs);
|
||||||
onPositionReset(positionUs, joining);
|
resetPosition(positionUs, joining);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,10 +162,14 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void resetPosition(long positionUs) throws ExoPlaybackException {
|
public final void resetPosition(long positionUs) throws ExoPlaybackException {
|
||||||
|
resetPosition(positionUs, /* joining= */ false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPosition(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||||
streamIsFinal = false;
|
streamIsFinal = false;
|
||||||
lastResetPositionUs = positionUs;
|
lastResetPositionUs = positionUs;
|
||||||
readingPositionUs = positionUs;
|
readingPositionUs = positionUs;
|
||||||
onPositionReset(positionUs, false);
|
onPositionReset(positionUs, joining);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user