diff --git a/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java b/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java index a1d4941f50..c65431a857 100644 --- a/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java +++ b/extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java @@ -39,7 +39,7 @@ import java.util.List; import java.util.concurrent.Callable; /** Manages the queue of player actions and handles running them one by one. */ -/* package */ class PlayerCommandQueue implements AutoCloseable { +/* package */ class PlayerCommandQueue { private static final String TAG = "PlayerCommandQueue"; private static final boolean DEBUG = false; @@ -141,9 +141,6 @@ import java.util.concurrent.Callable; @GuardedBy("lock") private final Deque pendingPlayerCommandQueue; - @GuardedBy("lock") - private boolean closed; - // Should be only used on the handler. @Nullable private AsyncPlayerCommandResult pendingAsyncPlayerCommandResult; @@ -154,17 +151,6 @@ import java.util.concurrent.Callable; pendingPlayerCommandQueue = new ArrayDeque<>(); } - @Override - public void close() { - synchronized (lock) { - if (closed) { - return; - } - closed = true; - } - reset(); - } - public void reset() { handler.removeCallbacksAndMessages(/* token= */ null); List queue; @@ -187,11 +173,6 @@ import java.util.concurrent.Callable; @CommandCode int commandCode, Callable command, @Nullable Object tag) { SettableFuture result = SettableFuture.create(); synchronized (lock) { - if (closed) { - // OK to set result with lock hold because developers cannot add listener here. - result.set(new PlayerResult(PlayerResult.RESULT_ERROR_INVALID_STATE, /* item= */ null)); - return result; - } PlayerCommand playerCommand = new PlayerCommand(commandCode, command, result, tag); result.addListener( () -> {