mirror of
https://github.com/androidx/media.git
synced 2025-05-07 23:50:44 +08:00
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
This commit is contained in:
parent
18a8655343
commit
e35f9addaf
@ -85,11 +85,6 @@ import java.util.Locale;
|
||||
Log.d(TAG, "discontinuity [" + periodIndex + ", " + positionMs + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyCommitted() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
|
||||
boolean isFinal = timeline.isFinal();
|
||||
|
@ -396,11 +396,6 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
|
||||
updateButtonVisibilities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyCommitted() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||
if (mediaController.isShowing()) {
|
||||
|
@ -90,11 +90,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyCommitted () {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||
// Do nothing.
|
||||
|
@ -90,11 +90,6 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyCommitted () {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||
// Do nothing.
|
||||
|
@ -109,11 +109,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@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
|
||||
@ -277,14 +266,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.
|
||||
*
|
||||
|
@ -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);
|
||||
@ -123,11 +121,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
return playWhenReady;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,11 +338,6 @@ public final class SimpleExoPlayer implements ExoPlayer {
|
||||
return player.getPlayWhenReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayWhenReadyCommitted() {
|
||||
return player.isPlayWhenReadyCommitted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoading() {
|
||||
return player.isLoading();
|
||||
|
@ -151,11 +151,6 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
|
||||
updateTextView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayWhenReadyCommitted() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||
updateTextView();
|
||||
|
@ -206,11 +206,6 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
|
||||
onPlayerErrorInternal(error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPlayWhenReadyCommitted() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||
// Do nothing.
|
||||
|
Loading…
x
Reference in New Issue
Block a user