Commit d1dc6134 by tonihei Committed by Tianyi Feng

Remove deprecated stop(boolean)

This method has been deprecated for over 2 years.

PiperOrigin-RevId: 520586238
parent e6db3479
...@@ -475,17 +475,6 @@ public final class CastPlayer extends BasePlayer { ...@@ -475,17 +475,6 @@ public final class CastPlayer extends BasePlayer {
@Override @Override
public void stop() { public void stop() {
stop(/* reset= */ false);
}
/**
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@Deprecated
@Override
public void stop(boolean reset) {
playbackState = STATE_IDLE; playbackState = STATE_IDLE;
if (remoteMediaClient != null) { if (remoteMediaClient != null) {
// TODO(b/69792021): Support or emulate stop without position reset. // TODO(b/69792021): Support or emulate stop without position reset.
......
...@@ -480,20 +480,6 @@ public class ForwardingPlayer implements Player { ...@@ -480,20 +480,6 @@ public class ForwardingPlayer implements Player {
player.stop(); player.stop();
} }
/**
* Calls {@link Player#stop(boolean)} on the delegate.
*
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@SuppressWarnings("deprecation") // Forwarding to deprecated method
@Deprecated
@Override
public void stop(boolean reset) {
player.stop(reset);
}
/** Calls {@link Player#release()} on the delegate. */ /** Calls {@link Player#release()} on the delegate. */
@Override @Override
public void release() { public void release() {
......
...@@ -2505,14 +2505,6 @@ public interface Player { ...@@ -2505,14 +2505,6 @@ public interface Player {
void stop(); void stop();
/** /**
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@Deprecated
void stop(boolean reset);
/**
* Releases the player. This method must be called when the player is no longer required. The * Releases the player. This method must be called when the player is no longer required. The
* player must not be used after calling this method. * player must not be used after calling this method.
* *
......
...@@ -2329,14 +2329,6 @@ public abstract class SimpleBasePlayer extends BasePlayer { ...@@ -2329,14 +2329,6 @@ public abstract class SimpleBasePlayer extends BasePlayer {
} }
@Override @Override
public final void stop(boolean reset) {
stop();
if (reset) {
clearMediaItems();
}
}
@Override
public final void release() { public final void release() {
verifyApplicationThreadAndInitState(); verifyApplicationThreadAndInitState();
// Use a local copy to ensure the lambda below uses the current state value. // Use a local copy to ensure the lambda below uses the current state value.
......
...@@ -945,7 +945,6 @@ import java.util.concurrent.TimeoutException; ...@@ -945,7 +945,6 @@ import java.util.concurrent.TimeoutException;
if (!internalPlayer.setForegroundMode(foregroundMode)) { if (!internalPlayer.setForegroundMode(foregroundMode)) {
// One of the renderers timed out releasing its resources. // One of the renderers timed out releasing its resources.
stopInternal( stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected( ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE), new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE),
PlaybackException.ERROR_CODE_TIMEOUT)); PlaybackException.ERROR_CODE_TIMEOUT));
...@@ -956,14 +955,8 @@ import java.util.concurrent.TimeoutException; ...@@ -956,14 +955,8 @@ import java.util.concurrent.TimeoutException;
@Override @Override
public void stop() { public void stop() {
verifyApplicationThread(); verifyApplicationThread();
stop(/* reset= */ false);
}
@Override
public void stop(boolean reset) {
verifyApplicationThread();
audioFocusManager.updateAudioFocus(getPlayWhenReady(), Player.STATE_IDLE); audioFocusManager.updateAudioFocus(getPlayWhenReady(), Player.STATE_IDLE);
stopInternal(reset, /* error= */ null); stopInternal(/* error= */ null);
currentCueGroup = new CueGroup(ImmutableList.of(), playbackInfo.positionUs); currentCueGroup = new CueGroup(ImmutableList.of(), playbackInfo.positionUs);
} }
...@@ -1748,38 +1741,27 @@ import java.util.concurrent.TimeoutException; ...@@ -1748,38 +1741,27 @@ import java.util.concurrent.TimeoutException;
/** /**
* Stops the player. * Stops the player.
* *
* @param reset Whether the playlist should be cleared and whether the playback position and
* playback error should be reset.
* @param error An optional {@link ExoPlaybackException} to set. * @param error An optional {@link ExoPlaybackException} to set.
*/ */
private void stopInternal(boolean reset, @Nullable ExoPlaybackException error) { private void stopInternal(@Nullable ExoPlaybackException error) {
PlaybackInfo playbackInfo; PlaybackInfo playbackInfo =
if (reset) { this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo = playbackInfo.bufferedPositionUs = playbackInfo.positionUs;
removeMediaItemsInternal( playbackInfo.totalBufferedDurationUs = 0;
/* fromIndex= */ 0, /* toIndex= */ mediaSourceHolderSnapshots.size());
playbackInfo = playbackInfo.copyWithPlaybackError(null);
} else {
playbackInfo = this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo.bufferedPositionUs = playbackInfo.positionUs;
playbackInfo.totalBufferedDurationUs = 0;
}
playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE); playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE);
if (error != null) { if (error != null) {
playbackInfo = playbackInfo.copyWithPlaybackError(error); playbackInfo = playbackInfo.copyWithPlaybackError(error);
} }
pendingOperationAcks++; pendingOperationAcks++;
internalPlayer.stop(); internalPlayer.stop();
boolean positionDiscontinuity =
playbackInfo.timeline.isEmpty() && !this.playbackInfo.timeline.isEmpty();
updatePlaybackInfo( updatePlaybackInfo(
playbackInfo, playbackInfo,
TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED, /* ignored */ TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED,
/* ignored */ PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST, /* ignored */ PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
/* seekProcessed= */ false, /* seekProcessed= */ false,
positionDiscontinuity, /* positionDiscontinuity= */ false,
DISCONTINUITY_REASON_REMOVE, /* ignored */ DISCONTINUITY_REASON_INTERNAL,
/* discontinuityWindowStartPositionUs= */ getCurrentPositionUsInternal(playbackInfo), /* ignored */ C.TIME_UNSET,
/* ignored */ C.INDEX_UNSET, /* ignored */ C.INDEX_UNSET,
/* repeatCurrentMediaItem= */ false); /* repeatCurrentMediaItem= */ false);
} }
...@@ -2578,7 +2560,6 @@ import java.util.concurrent.TimeoutException; ...@@ -2578,7 +2560,6 @@ import java.util.concurrent.TimeoutException;
this.videoOutput = videoOutput; this.videoOutput = videoOutput;
if (messageDeliveryTimedOut) { if (messageDeliveryTimedOut) {
stopInternal( stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected( ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_DETACH_SURFACE), new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_DETACH_SURFACE),
PlaybackException.ERROR_CODE_TIMEOUT)); PlaybackException.ERROR_CODE_TIMEOUT));
......
...@@ -1068,18 +1068,6 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1068,18 +1068,6 @@ public class SimpleExoPlayer extends BasePlayer
player.stop(); player.stop();
} }
/**
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@Deprecated
@Override
public void stop(boolean reset) {
blockUntilConstructorFinished();
player.stop(reset);
}
@Override @Override
public void release() { public void release() {
blockUntilConstructorFinished(); blockUntilConstructorFinished();
......
...@@ -337,13 +337,11 @@ public abstract class Action { ...@@ -337,13 +337,11 @@ public abstract class Action {
} }
} }
/** Calls {@link Player#stop()} or {@link Player#stop(boolean)}. */ /** Calls {@link Player#stop()}. */
public static final class Stop extends Action { public static final class Stop extends Action {
private static final String STOP_ACTION_TAG = "Stop"; private static final String STOP_ACTION_TAG = "Stop";
@Nullable private final Boolean reset;
/** /**
* Action will call {@link Player#stop()}. * Action will call {@link Player#stop()}.
* *
...@@ -351,28 +349,12 @@ public abstract class Action { ...@@ -351,28 +349,12 @@ public abstract class Action {
*/ */
public Stop(String tag) { public Stop(String tag) {
super(tag, STOP_ACTION_TAG); super(tag, STOP_ACTION_TAG);
this.reset = null;
}
/**
* Action will call {@link Player#stop(boolean)}.
*
* @param tag A tag to use for logging.
* @param reset The value to pass to {@link Player#stop(boolean)}.
*/
public Stop(@Size(max = 23) String tag, boolean reset) {
super(tag, STOP_ACTION_TAG);
this.reset = reset;
} }
@Override @Override
protected void doActionImpl( protected void doActionImpl(
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (reset == null) { player.stop();
player.stop();
} else {
player.stop(reset);
}
} }
} }
......
...@@ -241,17 +241,6 @@ public final class ActionSchedule { ...@@ -241,17 +241,6 @@ public final class ActionSchedule {
} }
/** /**
* Schedules a stop action.
*
* @param reset Whether the player should be reset.
* @return The builder, for convenience.
*/
@CanIgnoreReturnValue
public Builder stop(boolean reset) {
return apply(new Stop(tag, reset));
}
/**
* Schedules a play action. * Schedules a play action.
* *
* @return The builder, for convenience. * @return The builder, for convenience.
......
...@@ -183,17 +183,6 @@ public class StubPlayer extends BasePlayer { ...@@ -183,17 +183,6 @@ public class StubPlayer extends BasePlayer {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/**
* @deprecated Use {@link #stop()} and {@link #clearMediaItems()} (if {@code reset} is true) or
* just {@link #stop()} (if {@code reset} is false). Any player error will be cleared when
* {@link #prepare() re-preparing} the player.
*/
@Deprecated
@Override
public void stop(boolean reset) {
throw new UnsupportedOperationException();
}
@Override @Override
public void release() { public void release() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
......
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