Fix reading position at stream transition.

PiperOrigin-RevId: 374836046
This commit is contained in:
tonihei 2021-05-20 11:34:09 +01:00 committed by Oliver Woodman
parent 8eb990e47a
commit 1a6f36d4a4
2 changed files with 5 additions and 4 deletions

View File

@ -113,7 +113,9 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities {
throws ExoPlaybackException { throws ExoPlaybackException {
Assertions.checkState(!streamIsFinal); Assertions.checkState(!streamIsFinal);
this.stream = stream; this.stream = stream;
readingPositionUs = offsetUs; if (readingPositionUs == C.TIME_END_OF_SOURCE) {
readingPositionUs = startPositionUs;
}
streamFormats = formats; streamFormats = formats;
streamOffsetUs = offsetUs; streamOffsetUs = offsetUs;
onStreamChanged(formats, startPositionUs, offsetUs); onStreamChanged(formats, startPositionUs, offsetUs);

View File

@ -339,9 +339,8 @@ public interface Renderer extends PlayerMessage.Target {
boolean hasReadStreamToEnd(); boolean hasReadStreamToEnd();
/** /**
* Returns the renderer time up to which the renderer has read samples from the current {@link * Returns the renderer time up to which the renderer has read samples, in microseconds, or {@link
* SampleStream}, in microseconds, or {@link C#TIME_END_OF_SOURCE} if the renderer has read the * C#TIME_END_OF_SOURCE} if the renderer has read the current {@link SampleStream} to the end.
* current {@link SampleStream} to the end.
* *
* <p>This method may be called when the renderer is in the following states: {@link * <p>This method may be called when the renderer is in the following states: {@link
* #STATE_ENABLED}, {@link #STATE_STARTED}. * #STATE_ENABLED}, {@link #STATE_STARTED}.