Skip to content

Commit

Permalink
Clarify MediaPeriod.readDiscontinuity Javadoc
Browse files Browse the repository at this point in the history
It currently wrongly documents that it is only called before reading
streams (that has never been the case and all MediaPeriods already need
to handle calls after reading samples from the streams).

It was also a bit unclear what a discontinuity implies and the new
Javadoc calls out the main use case for discontinuties and the intended
meaning of returning a discontinuity.

#minor-release

PiperOrigin-RevId: 543989124
  • Loading branch information
tonihei authored and tianyif committed Jun 29, 2023
1 parent a632118 commit b324b8a
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,18 @@ long selectTracks(
/**
* Attempts to read a discontinuity.
*
* <p>A discontinuity implies that the provided {@link SampleStream SampleStreams} will start from
* a new playback position and any output pipelines need to be reset. This happens for example if
* the streams provide decode-only samples before the intended playback start position that need
* to be dropped.
*
* <p>After this method has returned a value other than {@link C#TIME_UNSET}, all {@link
* SampleStream}s provided by the period are guaranteed to start from a key frame.
* SampleStream SampleStreams} provided by the period are guaranteed to start from a key frame.
*
* <p>This method is only called after the period has been prepared and before reading from any
* {@link SampleStream}s provided by the period.
* <p>This method is only called after the period has been prepared.
*
* @return If a discontinuity was read then the playback position in microseconds after the
* discontinuity. Else {@link C#TIME_UNSET}.
* @return The playback position after the discontinuity, in microseconds, or {@link C#TIME_UNSET}
* if there is no discontinuity.
*/
long readDiscontinuity();

Expand Down

0 comments on commit b324b8a

Please sign in to comment.