From 0226543090e58d43110f380efc04d4b43b73394c Mon Sep 17 00:00:00 2001 From: tonihei Date: Mon, 21 Dec 2020 15:08:03 +0000 Subject: [PATCH] Remove experimental method to disable stuck buffering detection. PiperOrigin-RevId: 348462189 --- .../google/android/exoplayer2/ExoPlayer.java | 19 ------------------ .../android/exoplayer2/ExoPlayerImpl.java | 10 ---------- .../exoplayer2/ExoPlayerImplInternal.java | 9 +-------- .../android/exoplayer2/SimpleExoPlayer.java | 20 ------------------- 4 files changed, 1 insertion(+), 57 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java index d2823d9505..66c5c30d2a 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java @@ -162,7 +162,6 @@ public interface ExoPlayer extends Player { private LivePlaybackSpeedControl livePlaybackSpeedControl; private boolean buildCalled; - private boolean throwWhenStuckBuffering; private long setForegroundModeTimeoutMs; /** @@ -228,7 +227,6 @@ public interface ExoPlayer extends Player { seekParameters = SeekParameters.DEFAULT; livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build(); clock = Clock.DEFAULT; - throwWhenStuckBuffering = true; releaseTimeoutMs = DEFAULT_RELEASE_TIMEOUT_MS; } @@ -246,19 +244,6 @@ public interface ExoPlayer extends Player { return this; } - /** - * Sets whether the player should throw when it detects it's stuck buffering. - * - *

This method is experimental, and will be renamed or removed in a future release. - * - * @param throwWhenStuckBuffering Whether to throw when the player detects it's stuck buffering. - * @return This builder. - */ - public Builder experimentalSetThrowWhenStuckBuffering(boolean throwWhenStuckBuffering) { - this.throwWhenStuckBuffering = throwWhenStuckBuffering; - return this; - } - /** * Sets the {@link TrackSelector} that will be used by the player. * @@ -460,10 +445,6 @@ public interface ExoPlayer extends Player { if (setForegroundModeTimeoutMs > 0) { player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs); } - if (!throwWhenStuckBuffering) { - player.experimentalDisableThrowWhenStuckBuffering(); - } - return player; } } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java index 109faff7f2..b2dd249acf 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java @@ -210,16 +210,6 @@ import java.util.concurrent.TimeoutException; internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs); } - /** - * Configures the player to not throw when it detects it's stuck buffering. - * - *

This method is experimental, and will be renamed or removed in a future release. It should - * only be called before the player is used. - */ - public void experimentalDisableThrowWhenStuckBuffering() { - internalPlayer.experimentalDisableThrowWhenStuckBuffering(); - } - @Override public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { internalPlayer.experimentalSetOffloadSchedulingEnabled(offloadSchedulingEnabled); diff --git a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java index 875f548a86..e872c007ff 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java @@ -205,7 +205,6 @@ import java.util.concurrent.atomic.AtomicBoolean; private boolean deliverPendingMessageAtStartPositionRequired; @Nullable private ExoPlaybackException pendingRecoverableError; - private boolean throwWhenStuckBuffering; private long setForegroundModeTimeoutMs; public ExoPlayerImplInternal( @@ -239,7 +238,6 @@ import java.util.concurrent.atomic.AtomicBoolean; this.pauseAtEndOfWindow = pauseAtEndOfWindow; this.clock = clock; - throwWhenStuckBuffering = true; backBufferDurationUs = loadControl.getBackBufferDurationUs(); retainBackBufferFromKeyframe = loadControl.retainBackBufferFromKeyframe(); @@ -274,10 +272,6 @@ import java.util.concurrent.atomic.AtomicBoolean; this.setForegroundModeTimeoutMs = setForegroundModeTimeoutMs; } - public void experimentalDisableThrowWhenStuckBuffering() { - throwWhenStuckBuffering = false; - } - public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { handler .obtainMessage( @@ -1012,8 +1006,7 @@ import java.util.concurrent.atomic.AtomicBoolean; renderers[i].maybeThrowStreamError(); } } - if (throwWhenStuckBuffering - && !playbackInfo.isLoading + if (!playbackInfo.isLoading && playbackInfo.totalBufferedDurationUs < 500_000 && isLoadingPossible()) { // Throw if the LoadControl prevents loading even if the buffer is empty or almost empty. We diff --git a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java index c4c50eaa03..96bd7deb80 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java @@ -119,7 +119,6 @@ public class SimpleExoPlayer extends BasePlayer private long releaseTimeoutMs; private long detachSurfaceTimeoutMs; private boolean pauseAtEndOfMediaItems; - private boolean throwWhenStuckBuffering; private boolean buildCalled; /** @@ -251,7 +250,6 @@ public class SimpleExoPlayer extends BasePlayer seekParameters = SeekParameters.DEFAULT; livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build(); clock = Clock.DEFAULT; - throwWhenStuckBuffering = true; releaseTimeoutMs = ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MS; detachSurfaceTimeoutMs = DEFAULT_DETACH_SURFACE_TIMEOUT_MS; } @@ -536,21 +534,6 @@ public class SimpleExoPlayer extends BasePlayer return this; } - /** - * Sets whether the player should throw when it detects it's stuck buffering. - * - *

This method is experimental, and will be renamed or removed in a future release. - * - * @param throwWhenStuckBuffering Whether to throw when the player detects it's stuck buffering. - * @return This builder. - * @throws IllegalStateException If {@link #build()} has already been called. - */ - public Builder experimentalSetThrowWhenStuckBuffering(boolean throwWhenStuckBuffering) { - Assertions.checkState(!buildCalled); - this.throwWhenStuckBuffering = throwWhenStuckBuffering; - return this; - } - /** * Sets the {@link Clock} that will be used by the player. Should only be set for testing * purposes. @@ -722,9 +705,6 @@ public class SimpleExoPlayer extends BasePlayer wifiLockManager = new WifiLockManager(builder.context); wifiLockManager.setEnabled(builder.wakeMode == C.WAKE_MODE_NETWORK); deviceInfo = createDeviceInfo(streamVolumeManager); - if (!builder.throwWhenStuckBuffering) { - player.experimentalDisableThrowWhenStuckBuffering(); - } sendRendererMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes); sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode);