Commit e35f9add by olly Committed by Oliver Woodman

Remove playWhenReadyCommitted.

This was always a bit of a hack; for Play Movies. It may well
no longer be necessary, and if not I'd like to think of a nicer
or more general way of doing it. We can always bring it back
if needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130373433
parent 18a86553
...@@ -86,11 +86,6 @@ import java.util.Locale; ...@@ -86,11 +86,6 @@ import java.util.Locale;
} }
@Override @Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) { public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
boolean isFinal = timeline.isFinal(); boolean isFinal = timeline.isFinal();
int periodCount = timeline.getPeriodCount(); int periodCount = timeline.getPeriodCount();
......
...@@ -397,11 +397,6 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi ...@@ -397,11 +397,6 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
} }
@Override @Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) { public void onPositionDiscontinuity(int periodIndex, long positionMs) {
if (mediaController.isShowing()) { if (mediaController.isShowing()) {
// The MediaController is visible, so force it to show the updated position immediately. // The MediaController is visible, so force it to show the updated position immediately.
......
...@@ -91,11 +91,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -91,11 +91,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
} }
@Override @Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) { public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing. // Do nothing.
} }
......
...@@ -91,11 +91,6 @@ public class OpusPlaybackTest extends InstrumentationTestCase { ...@@ -91,11 +91,6 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
} }
@Override @Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) { public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing. // Do nothing.
} }
......
...@@ -110,11 +110,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -110,11 +110,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
} }
@Override @Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) { public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing. // Do nothing.
} }
......
...@@ -117,17 +117,6 @@ public interface ExoPlayer { ...@@ -117,17 +117,6 @@ public interface ExoPlayer {
*/ */
void onPlayerStateChanged(boolean playWhenReady, int playbackState); void onPlayerStateChanged(boolean playWhenReady, int playbackState);
/**
* Called when the current value of {@link #getPlayWhenReady()} has been reflected by
* the internal playback thread.
* <p>
* An invocation of this method will shortly follow any call to
* {@link #setPlayWhenReady(boolean)} that changes the state. If multiple calls are made in
* rapid succession, then this method will be called only once, after the final state has been
* reflected.
*/
void onPlayWhenReadyCommitted();
// TODO[playlists]: Should source-initiated resets also cause this to be called? // TODO[playlists]: Should source-initiated resets also cause this to be called?
/** /**
* Called when the player's position changes due to a discontinuity (seeking or playback * Called when the player's position changes due to a discontinuity (seeking or playback
...@@ -278,14 +267,6 @@ public interface ExoPlayer { ...@@ -278,14 +267,6 @@ public interface ExoPlayer {
boolean getPlayWhenReady(); boolean getPlayWhenReady();
/** /**
* Whether the current value of {@link #getPlayWhenReady()} has been reflected by the internal
* playback thread.
*
* @return Whether the current value has been reflected.
*/
boolean isPlayWhenReadyCommitted();
/**
* Whether the player is currently loading the source. * Whether the player is currently loading the source.
* *
* @return Whether the player is currently loading the source. * @return Whether the player is currently loading the source.
......
...@@ -40,7 +40,6 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -40,7 +40,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
private boolean playWhenReady; private boolean playWhenReady;
private int playbackState; private int playbackState;
private int pendingPlayWhenReadyAcks;
private int pendingSeekAcks; private int pendingSeekAcks;
private boolean isLoading; private boolean isLoading;
private Timeline timeline; private Timeline timeline;
...@@ -110,7 +109,6 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -110,7 +109,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
public void setPlayWhenReady(boolean playWhenReady) { public void setPlayWhenReady(boolean playWhenReady) {
if (this.playWhenReady != playWhenReady) { if (this.playWhenReady != playWhenReady) {
this.playWhenReady = playWhenReady; this.playWhenReady = playWhenReady;
pendingPlayWhenReadyAcks++;
internalPlayer.setPlayWhenReady(playWhenReady); internalPlayer.setPlayWhenReady(playWhenReady);
for (EventListener listener : listeners) { for (EventListener listener : listeners) {
listener.onPlayerStateChanged(playWhenReady, playbackState); listener.onPlayerStateChanged(playWhenReady, playbackState);
...@@ -124,11 +122,6 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -124,11 +122,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
} }
@Override @Override
public boolean isPlayWhenReadyCommitted() {
return pendingPlayWhenReadyAcks == 0;
}
@Override
public boolean isLoading() { public boolean isLoading() {
return isLoading; return isLoading;
} }
...@@ -242,15 +235,6 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -242,15 +235,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
} }
break; break;
} }
case ExoPlayerImplInternal.MSG_SET_PLAY_WHEN_READY_ACK: {
pendingPlayWhenReadyAcks--;
if (pendingPlayWhenReadyAcks == 0) {
for (EventListener listener : listeners) {
listener.onPlayWhenReadyCommitted();
}
}
break;
}
case ExoPlayerImplInternal.MSG_SEEK_ACK: { case ExoPlayerImplInternal.MSG_SEEK_ACK: {
if (--pendingSeekAcks == 0) { if (--pendingSeekAcks == 0) {
long positionMs = playbackInfo.startPositionUs == C.UNSET_TIME_US ? 0 long positionMs = playbackInfo.startPositionUs == C.UNSET_TIME_US ? 0
......
...@@ -66,11 +66,10 @@ import java.io.IOException; ...@@ -66,11 +66,10 @@ import java.io.IOException;
// External messages // External messages
public static final int MSG_STATE_CHANGED = 1; public static final int MSG_STATE_CHANGED = 1;
public static final int MSG_LOADING_CHANGED = 2; public static final int MSG_LOADING_CHANGED = 2;
public static final int MSG_SET_PLAY_WHEN_READY_ACK = 3; public static final int MSG_SEEK_ACK = 3;
public static final int MSG_SEEK_ACK = 4; public static final int MSG_POSITION_DISCONTINUITY = 4;
public static final int MSG_POSITION_DISCONTINUITY = 5; public static final int MSG_SOURCE_INFO_REFRESHED = 5;
public static final int MSG_SOURCE_INFO_REFRESHED = 6; public static final int MSG_ERROR = 6;
public static final int MSG_ERROR = 7;
// Internal messages // Internal messages
private static final int MSG_SET_MEDIA_SOURCE = 0; private static final int MSG_SET_MEDIA_SOURCE = 0;
...@@ -348,22 +347,18 @@ import java.io.IOException; ...@@ -348,22 +347,18 @@ import java.io.IOException;
} }
private void setPlayWhenReadyInternal(boolean playWhenReady) throws ExoPlaybackException { private void setPlayWhenReadyInternal(boolean playWhenReady) throws ExoPlaybackException {
try { rebuffering = false;
rebuffering = false; this.playWhenReady = playWhenReady;
this.playWhenReady = playWhenReady; if (!playWhenReady) {
if (!playWhenReady) { stopRenderers();
stopRenderers(); updatePlaybackPositions();
updatePlaybackPositions(); } else {
} else { if (state == ExoPlayer.STATE_READY) {
if (state == ExoPlayer.STATE_READY) { startRenderers();
startRenderers(); handler.sendEmptyMessage(MSG_DO_SOME_WORK);
handler.sendEmptyMessage(MSG_DO_SOME_WORK); } else if (state == ExoPlayer.STATE_BUFFERING) {
} else if (state == ExoPlayer.STATE_BUFFERING) { handler.sendEmptyMessage(MSG_DO_SOME_WORK);
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
} }
} finally {
eventHandler.sendEmptyMessage(MSG_SET_PLAY_WHEN_READY_ACK);
} }
} }
......
...@@ -339,11 +339,6 @@ public final class SimpleExoPlayer implements ExoPlayer { ...@@ -339,11 +339,6 @@ public final class SimpleExoPlayer implements ExoPlayer {
} }
@Override @Override
public boolean isPlayWhenReadyCommitted() {
return player.isPlayWhenReadyCommitted();
}
@Override
public boolean isLoading() { public boolean isLoading() {
return player.isLoading(); return player.isLoading();
} }
......
...@@ -152,11 +152,6 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe ...@@ -152,11 +152,6 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
} }
@Override @Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) { public void onPositionDiscontinuity(int periodIndex, long positionMs) {
updateTextView(); updateTextView();
} }
......
...@@ -207,11 +207,6 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen ...@@ -207,11 +207,6 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
} }
@Override @Override
public final void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public final void onPositionDiscontinuity(int periodIndex, long positionMs) { public final void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing. // Do nothing.
} }
......
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