Commit b3788ce5 by tonihei Committed by Tianyi Feng

Remove deprecated stop(boolean)

This method has been deprecated for over 2 years.

PiperOrigin-RevId: 520586238
parent f4a3478d
......@@ -58,6 +58,8 @@
* Remove `DefaultAudioSink` constructors, use `DefaultAudioSink.Builder`
instead.
* Remove `HlsMasterPlaylist`, use `HlsMultivariantPlaylist` instead.
* Remove `Player.stop(boolean)`. Use `Player.stop()` and
`Player.clearMediaItems()` (if `reset` is `true`) instead.
### 1.0.0 (2023-03-22)
......
......@@ -477,17 +477,6 @@ public final class CastPlayer extends BasePlayer {
@Override
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;
if (remoteMediaClient != null) {
// TODO(b/69792021): Support or emulate stop without position reset.
......
......@@ -478,20 +478,6 @@ public class ForwardingPlayer implements Player {
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. */
@Override
public void release() {
......
......@@ -2525,15 +2525,6 @@ public interface Player {
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.
*/
@UnstableApi
@Deprecated
void stop(boolean reset);
/**
* 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.
*
......
......@@ -2326,14 +2326,6 @@ public abstract class SimpleBasePlayer extends BasePlayer {
}
@Override
public final void stop(boolean reset) {
stop();
if (reset) {
clearMediaItems();
}
}
@Override
public final void release() {
verifyApplicationThreadAndInitState();
// Use a local copy to ensure the lambda below uses the current state value.
......
......@@ -956,7 +956,6 @@ import java.util.concurrent.TimeoutException;
if (!internalPlayer.setForegroundMode(foregroundMode)) {
// One of the renderers timed out releasing its resources.
stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_SET_FOREGROUND_MODE),
PlaybackException.ERROR_CODE_TIMEOUT));
......@@ -967,14 +966,8 @@ import java.util.concurrent.TimeoutException;
@Override
public void stop() {
verifyApplicationThread();
stop(/* reset= */ false);
}
@Override
public void stop(boolean reset) {
verifyApplicationThread();
audioFocusManager.updateAudioFocus(getPlayWhenReady(), Player.STATE_IDLE);
stopInternal(reset, /* error= */ null);
stopInternal(/* error= */ null);
currentCueGroup = new CueGroup(ImmutableList.of(), playbackInfo.positionUs);
}
......@@ -1759,38 +1752,27 @@ import java.util.concurrent.TimeoutException;
/**
* 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.
*/
private void stopInternal(boolean reset, @Nullable ExoPlaybackException error) {
PlaybackInfo playbackInfo;
if (reset) {
playbackInfo =
removeMediaItemsInternal(
/* fromIndex= */ 0, /* toIndex= */ mediaSourceHolderSnapshots.size());
playbackInfo = playbackInfo.copyWithPlaybackError(null);
} else {
playbackInfo = this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo.bufferedPositionUs = playbackInfo.positionUs;
playbackInfo.totalBufferedDurationUs = 0;
}
private void stopInternal(@Nullable ExoPlaybackException error) {
PlaybackInfo playbackInfo =
this.playbackInfo.copyWithLoadingMediaPeriodId(this.playbackInfo.periodId);
playbackInfo.bufferedPositionUs = playbackInfo.positionUs;
playbackInfo.totalBufferedDurationUs = 0;
playbackInfo = playbackInfo.copyWithPlaybackState(Player.STATE_IDLE);
if (error != null) {
playbackInfo = playbackInfo.copyWithPlaybackError(error);
}
pendingOperationAcks++;
internalPlayer.stop();
boolean positionDiscontinuity =
playbackInfo.timeline.isEmpty() && !this.playbackInfo.timeline.isEmpty();
updatePlaybackInfo(
playbackInfo,
TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED,
/* ignored */ TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED,
/* ignored */ PLAY_WHEN_READY_CHANGE_REASON_USER_REQUEST,
/* seekProcessed= */ false,
positionDiscontinuity,
DISCONTINUITY_REASON_REMOVE,
/* discontinuityWindowStartPositionUs= */ getCurrentPositionUsInternal(playbackInfo),
/* positionDiscontinuity= */ false,
/* ignored */ DISCONTINUITY_REASON_INTERNAL,
/* ignored */ C.TIME_UNSET,
/* ignored */ C.INDEX_UNSET,
/* repeatCurrentMediaItem= */ false);
}
......@@ -2589,7 +2571,6 @@ import java.util.concurrent.TimeoutException;
this.videoOutput = videoOutput;
if (messageDeliveryTimedOut) {
stopInternal(
/* reset= */ false,
ExoPlaybackException.createForUnexpected(
new ExoTimeoutException(ExoTimeoutException.TIMEOUT_OPERATION_DETACH_SURFACE),
PlaybackException.ERROR_CODE_TIMEOUT));
......
......@@ -1079,18 +1079,6 @@ public class SimpleExoPlayer extends BasePlayer
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
public void release() {
blockUntilConstructorFinished();
......
......@@ -471,21 +471,6 @@ public class MediaController implements Player {
}
/**
* @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.
*/
@UnstableApi
@Deprecated
@Override
public void stop(boolean reset) {
stop();
if (reset) {
clearMediaItems();
}
}
/**
* Releases the connection between {@link MediaController} and {@link MediaSession}. This method
* must be called when the controller is no longer required. The controller must not be used after
* calling this method.
......
......@@ -314,17 +314,6 @@ public class MockPlayer implements Player {
checkNotNull(conditionVariables.get(METHOD_STOP)).open();
}
/**
* @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
public void addListener(Listener listener) {
listeners.add(listener);
......
......@@ -339,13 +339,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 {
private static final String STOP_ACTION_TAG = "Stop";
@Nullable private final Boolean reset;
/**
* Action will call {@link Player#stop()}.
*
......@@ -353,28 +351,12 @@ public abstract class Action {
*/
public Stop(String 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
protected void doActionImpl(
ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) {
if (reset == null) {
player.stop();
} else {
player.stop(reset);
}
player.stop();
}
}
......
......@@ -243,17 +243,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.
*
* @return The builder, for convenience.
......
......@@ -185,17 +185,6 @@ public class StubPlayer extends BasePlayer {
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
public void release() {
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