Don't consider switching tracks as "joining".

I'm not really sure how best to document this in TrackRenderer;
it's a bit of a weird feature. For now, I've gone with the vague
approach.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112150939
This commit is contained in:
olly 2016-01-14 07:50:12 -08:00 committed by Oliver Woodman
parent 317842a6b7
commit be2aedbd53
2 changed files with 5 additions and 7 deletions

View file

@ -640,7 +640,9 @@ import java.util.concurrent.atomic.AtomicInteger;
if (shouldEnable) {
// Re-enable the renderer with the newly selected track.
boolean playing = playWhenReady && state == ExoPlayer.STATE_READY;
renderer.enable(trackIndex, positionUs, playing);
// Consider as joining if the renderer was previously disabled, but not when switching tracks.
boolean joining = !isEnabled && playing;
renderer.enable(trackIndex, positionUs, joining);
enabledRenderers.add(renderer);
if (playing) {
renderer.start();

View file

@ -150,9 +150,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
*
* @param track The track for which the renderer is being enabled.
* @param positionUs The player's current position.
* @param joining Whether this renderer is being enabled to join an ongoing playback. If true
* then {@link #start} must be called immediately after this method returns (unless a
* {@link ExoPlaybackException} is thrown).
* @param joining Whether this renderer is being enabled to join an ongoing playback.
* @throws ExoPlaybackException If an error occurs.
*/
/* package */ final void enable(int track, long positionUs, boolean joining)
@ -169,9 +167,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
*
* @param track The track for which the renderer is being enabled.
* @param positionUs The player's current position.
* @param joining Whether this renderer is being enabled to join an ongoing playback. If true
* then {@link #onStarted} is guaranteed to be called immediately after this method returns
* (unless a {@link ExoPlaybackException} is thrown).
* @param joining Whether this renderer is being enabled to join an ongoing playback.
* @throws ExoPlaybackException If an error occurs.
*/
protected void onEnabled(int track, long positionUs, boolean joining)