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;
}
@Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
boolean isFinal = timeline.isFinal();
int periodCount = timeline.getPeriodCount();
......
......@@ -397,11 +397,6 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
}
@Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
if (mediaController.isShowing()) {
// The MediaController is visible, so force it to show the updated position immediately.
......
......@@ -91,11 +91,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing.
}
......
......@@ -91,11 +91,6 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing.
}
......
......@@ -110,11 +110,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
}
@Override
public void onPlayWhenReadyCommitted () {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
// Do nothing.
}
......
......@@ -117,17 +117,6 @@ public interface ExoPlayer {
*/
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?
/**
* Called when the player's position changes due to a discontinuity (seeking or playback
......@@ -278,14 +267,6 @@ public interface ExoPlayer {
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.
*
* @return Whether the player is currently loading the source.
......
......@@ -40,7 +40,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
private boolean playWhenReady;
private int playbackState;
private int pendingPlayWhenReadyAcks;
private int pendingSeekAcks;
private boolean isLoading;
private Timeline timeline;
......@@ -110,7 +109,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
public void setPlayWhenReady(boolean playWhenReady) {
if (this.playWhenReady != playWhenReady) {
this.playWhenReady = playWhenReady;
pendingPlayWhenReadyAcks++;
internalPlayer.setPlayWhenReady(playWhenReady);
for (EventListener listener : listeners) {
listener.onPlayerStateChanged(playWhenReady, playbackState);
......@@ -124,11 +122,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
@Override
public boolean isPlayWhenReadyCommitted() {
return pendingPlayWhenReadyAcks == 0;
}
@Override
public boolean isLoading() {
return isLoading;
}
......@@ -242,15 +235,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
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: {
if (--pendingSeekAcks == 0) {
long positionMs = playbackInfo.startPositionUs == C.UNSET_TIME_US ? 0
......
......@@ -66,11 +66,10 @@ import java.io.IOException;
// External messages
public static final int MSG_STATE_CHANGED = 1;
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 = 4;
public static final int MSG_POSITION_DISCONTINUITY = 5;
public static final int MSG_SOURCE_INFO_REFRESHED = 6;
public static final int MSG_ERROR = 7;
public static final int MSG_SEEK_ACK = 3;
public static final int MSG_POSITION_DISCONTINUITY = 4;
public static final int MSG_SOURCE_INFO_REFRESHED = 5;
public static final int MSG_ERROR = 6;
// Internal messages
private static final int MSG_SET_MEDIA_SOURCE = 0;
......@@ -348,22 +347,18 @@ import java.io.IOException;
}
private void setPlayWhenReadyInternal(boolean playWhenReady) throws ExoPlaybackException {
try {
rebuffering = false;
this.playWhenReady = playWhenReady;
if (!playWhenReady) {
stopRenderers();
updatePlaybackPositions();
} else {
if (state == ExoPlayer.STATE_READY) {
startRenderers();
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} else if (state == ExoPlayer.STATE_BUFFERING) {
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
}
rebuffering = false;
this.playWhenReady = playWhenReady;
if (!playWhenReady) {
stopRenderers();
updatePlaybackPositions();
} else {
if (state == ExoPlayer.STATE_READY) {
startRenderers();
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
} else if (state == ExoPlayer.STATE_BUFFERING) {
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 {
}
@Override
public boolean isPlayWhenReadyCommitted() {
return player.isPlayWhenReadyCommitted();
}
@Override
public boolean isLoading() {
return player.isLoading();
}
......
......@@ -152,11 +152,6 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
}
@Override
public void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
updateTextView();
}
......
......@@ -207,11 +207,6 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
}
@Override
public final void onPlayWhenReadyCommitted() {
// Do nothing.
}
@Override
public final void onPositionDiscontinuity(int periodIndex, long positionMs) {
// 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