Commit be2aedbd by olly Committed by Oliver Woodman

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
parent 317842a6
......@@ -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();
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment