mirror of
https://github.com/androidx/media.git
synced 2025-05-11 01:31:40 +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 + "]");
|
Log.d(TAG, "discontinuity [" + periodIndex + ", " + positionMs + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted() {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
|
public void onSourceInfoRefreshed(Timeline timeline, Object manifest) {
|
||||||
boolean isFinal = timeline.isFinal();
|
boolean isFinal = timeline.isFinal();
|
||||||
|
@ -396,11 +396,6 @@ public class PlayerActivity extends Activity implements OnKeyListener, OnTouchLi
|
|||||||
updateButtonVisibilities();
|
updateButtonVisibilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted() {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||||
if (mediaController.isShowing()) {
|
if (mediaController.isShowing()) {
|
||||||
|
@ -90,11 +90,6 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted () {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
@ -90,11 +90,6 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted () {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
@ -109,11 +109,6 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted () {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@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 {
|
|||||||
*/
|
*/
|
||||||
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
|
||||||
@ -277,14 +266,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.
|
||||||
*
|
*
|
||||||
|
@ -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;
|
|||||||
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);
|
||||||
@ -123,11 +121,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
return playWhenReady;
|
return playWhenReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPlayWhenReadyCommitted() {
|
|
||||||
return pendingPlayWhenReadyAcks == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLoading() {
|
public boolean isLoading() {
|
||||||
return isLoading;
|
return isLoading;
|
||||||
@ -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;
|
|||||||
// 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,7 +347,6 @@ 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) {
|
||||||
@ -362,9 +360,6 @@ import java.io.IOException;
|
|||||||
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
|
handler.sendEmptyMessage(MSG_DO_SOME_WORK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
eventHandler.sendEmptyMessage(MSG_SET_PLAY_WHEN_READY_ACK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startRenderers() throws ExoPlaybackException {
|
private void startRenderers() throws ExoPlaybackException {
|
||||||
|
@ -338,11 +338,6 @@ public final class SimpleExoPlayer implements ExoPlayer {
|
|||||||
return player.getPlayWhenReady();
|
return player.getPlayWhenReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPlayWhenReadyCommitted() {
|
|
||||||
return player.isPlayWhenReadyCommitted();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLoading() {
|
public boolean isLoading() {
|
||||||
return player.isLoading();
|
return player.isLoading();
|
||||||
|
@ -151,11 +151,6 @@ public final class DebugTextViewHelper implements Runnable, ExoPlayer.EventListe
|
|||||||
updateTextView();
|
updateTextView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPlayWhenReadyCommitted() {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
public void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||||
updateTextView();
|
updateTextView();
|
||||||
|
@ -206,11 +206,6 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
|
|||||||
onPlayerErrorInternal(error);
|
onPlayerErrorInternal(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayWhenReadyCommitted() {
|
|
||||||
// Do nothing.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
public final void onPositionDiscontinuity(int periodIndex, long positionMs) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user