From b8ef1dcc78ed240c7f7535fea193e53d1b5a3867 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 18 Oct 2017 06:08:51 -0700 Subject: [PATCH] Fix MediaPeriod position param Javadoc. prepare and selectTracks receive the position from which any loading should start, where-as continueLoading receives the actual playback position. These are different in the case that a previous period is still being played out. Also removed "relative to the start of the period" from prepare documentation because it couldn't really be relative to anything else. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172592769 --- .../google/android/exoplayer2/source/MediaPeriod.java | 10 ++++++---- .../android/exoplayer2/source/SequenceableLoader.java | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaPeriod.java b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaPeriod.java index 514b96ae8d..7d16f794cd 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/MediaPeriod.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/MediaPeriod.java @@ -58,8 +58,7 @@ public interface MediaPeriod extends SequenceableLoader { * * @param callback Callback to receive updates from this period, including being notified when * preparation completes. - * @param positionUs The position in microseconds relative to the start of the period at which to - * start loading data. + * @param positionUs The expected starting position, in microseconds. */ void prepare(Callback callback, long positionUs); @@ -103,7 +102,8 @@ public interface MediaPeriod extends SequenceableLoader { * selections. * @param streamResetFlags Will be updated to indicate new sample streams, and sample streams that * have been retained but with the requirement that the consuming renderer be reset. - * @param positionUs The current playback position in microseconds. + * @param positionUs The current playback position in microseconds. If playback of this period has + * not yet started, the value will be the starting position. * @return The actual position at which the tracks were enabled, in microseconds. */ long selectTracks(TrackSelection[] selections, boolean[] mayRetainStreamFlags, @@ -176,7 +176,9 @@ public interface MediaPeriod extends SequenceableLoader { * called when the period is permitted to continue loading data. A period may do this both during * and after preparation. * - * @param positionUs The current playback position. + * @param positionUs The current playback position in microseconds. If playback of this period has + * not yet started, the value will be the starting position minus the duration of any media in + * previous periods still to be played. * @return True if progress was made, meaning that {@link #getNextLoadPositionUs()} will return * a different value than prior to the call. False otherwise. */ diff --git a/library/core/src/main/java/com/google/android/exoplayer2/source/SequenceableLoader.java b/library/core/src/main/java/com/google/android/exoplayer2/source/SequenceableLoader.java index 26cb9a2666..e40ceab976 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/source/SequenceableLoader.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/source/SequenceableLoader.java @@ -52,7 +52,9 @@ public interface SequenceableLoader { /** * Attempts to continue loading. * - * @param positionUs The current playback position. + * @param positionUs The current playback position in microseconds. If playback of the period to + * which this loader belongs has not yet started, the value will be the period's starting + * position minus the duration of any media in previous periods still to be played. * @return True if progress was made, meaning that {@link #getNextLoadPositionUs()} will return * a different value than prior to the call. False otherwise. */