Remove experimental method to disable stuck buffering detection.

PiperOrigin-RevId: 348462189
This commit is contained in:
tonihei 2020-12-21 15:08:03 +00:00 committed by Oliver Woodman
parent 85d094a2b6
commit 0226543090
4 changed files with 1 additions and 57 deletions

View File

@ -162,7 +162,6 @@ public interface ExoPlayer extends Player {
private LivePlaybackSpeedControl livePlaybackSpeedControl; private LivePlaybackSpeedControl livePlaybackSpeedControl;
private boolean buildCalled; private boolean buildCalled;
private boolean throwWhenStuckBuffering;
private long setForegroundModeTimeoutMs; private long setForegroundModeTimeoutMs;
/** /**
@ -228,7 +227,6 @@ public interface ExoPlayer extends Player {
seekParameters = SeekParameters.DEFAULT; seekParameters = SeekParameters.DEFAULT;
livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build(); livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build();
clock = Clock.DEFAULT; clock = Clock.DEFAULT;
throwWhenStuckBuffering = true;
releaseTimeoutMs = DEFAULT_RELEASE_TIMEOUT_MS; releaseTimeoutMs = DEFAULT_RELEASE_TIMEOUT_MS;
} }
@ -246,19 +244,6 @@ public interface ExoPlayer extends Player {
return this; return this;
} }
/**
* Sets whether the player should throw when it detects it's stuck buffering.
*
* <p>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. * Sets the {@link TrackSelector} that will be used by the player.
* *
@ -460,10 +445,6 @@ public interface ExoPlayer extends Player {
if (setForegroundModeTimeoutMs > 0) { if (setForegroundModeTimeoutMs > 0) {
player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs); player.experimentalSetForegroundModeTimeoutMs(setForegroundModeTimeoutMs);
} }
if (!throwWhenStuckBuffering) {
player.experimentalDisableThrowWhenStuckBuffering();
}
return player; return player;
} }
} }

View File

@ -210,16 +210,6 @@ import java.util.concurrent.TimeoutException;
internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs); internalPlayer.experimentalSetForegroundModeTimeoutMs(timeoutMs);
} }
/**
* Configures the player to not throw when it detects it's stuck buffering.
*
* <p>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 @Override
public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) {
internalPlayer.experimentalSetOffloadSchedulingEnabled(offloadSchedulingEnabled); internalPlayer.experimentalSetOffloadSchedulingEnabled(offloadSchedulingEnabled);

View File

@ -205,7 +205,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
private boolean deliverPendingMessageAtStartPositionRequired; private boolean deliverPendingMessageAtStartPositionRequired;
@Nullable private ExoPlaybackException pendingRecoverableError; @Nullable private ExoPlaybackException pendingRecoverableError;
private boolean throwWhenStuckBuffering;
private long setForegroundModeTimeoutMs; private long setForegroundModeTimeoutMs;
public ExoPlayerImplInternal( public ExoPlayerImplInternal(
@ -239,7 +238,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
this.pauseAtEndOfWindow = pauseAtEndOfWindow; this.pauseAtEndOfWindow = pauseAtEndOfWindow;
this.clock = clock; this.clock = clock;
throwWhenStuckBuffering = true;
backBufferDurationUs = loadControl.getBackBufferDurationUs(); backBufferDurationUs = loadControl.getBackBufferDurationUs();
retainBackBufferFromKeyframe = loadControl.retainBackBufferFromKeyframe(); retainBackBufferFromKeyframe = loadControl.retainBackBufferFromKeyframe();
@ -274,10 +272,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
this.setForegroundModeTimeoutMs = setForegroundModeTimeoutMs; this.setForegroundModeTimeoutMs = setForegroundModeTimeoutMs;
} }
public void experimentalDisableThrowWhenStuckBuffering() {
throwWhenStuckBuffering = false;
}
public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) {
handler handler
.obtainMessage( .obtainMessage(
@ -1012,8 +1006,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
renderers[i].maybeThrowStreamError(); renderers[i].maybeThrowStreamError();
} }
} }
if (throwWhenStuckBuffering if (!playbackInfo.isLoading
&& !playbackInfo.isLoading
&& playbackInfo.totalBufferedDurationUs < 500_000 && playbackInfo.totalBufferedDurationUs < 500_000
&& isLoadingPossible()) { && isLoadingPossible()) {
// Throw if the LoadControl prevents loading even if the buffer is empty or almost empty. We // Throw if the LoadControl prevents loading even if the buffer is empty or almost empty. We

View File

@ -119,7 +119,6 @@ public class SimpleExoPlayer extends BasePlayer
private long releaseTimeoutMs; private long releaseTimeoutMs;
private long detachSurfaceTimeoutMs; private long detachSurfaceTimeoutMs;
private boolean pauseAtEndOfMediaItems; private boolean pauseAtEndOfMediaItems;
private boolean throwWhenStuckBuffering;
private boolean buildCalled; private boolean buildCalled;
/** /**
@ -251,7 +250,6 @@ public class SimpleExoPlayer extends BasePlayer
seekParameters = SeekParameters.DEFAULT; seekParameters = SeekParameters.DEFAULT;
livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build(); livePlaybackSpeedControl = new DefaultLivePlaybackSpeedControl.Builder().build();
clock = Clock.DEFAULT; clock = Clock.DEFAULT;
throwWhenStuckBuffering = true;
releaseTimeoutMs = ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MS; releaseTimeoutMs = ExoPlayer.DEFAULT_RELEASE_TIMEOUT_MS;
detachSurfaceTimeoutMs = DEFAULT_DETACH_SURFACE_TIMEOUT_MS; detachSurfaceTimeoutMs = DEFAULT_DETACH_SURFACE_TIMEOUT_MS;
} }
@ -536,21 +534,6 @@ public class SimpleExoPlayer extends BasePlayer
return this; return this;
} }
/**
* Sets whether the player should throw when it detects it's stuck buffering.
*
* <p>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 * Sets the {@link Clock} that will be used by the player. Should only be set for testing
* purposes. * purposes.
@ -722,9 +705,6 @@ public class SimpleExoPlayer extends BasePlayer
wifiLockManager = new WifiLockManager(builder.context); wifiLockManager = new WifiLockManager(builder.context);
wifiLockManager.setEnabled(builder.wakeMode == C.WAKE_MODE_NETWORK); wifiLockManager.setEnabled(builder.wakeMode == C.WAKE_MODE_NETWORK);
deviceInfo = createDeviceInfo(streamVolumeManager); deviceInfo = createDeviceInfo(streamVolumeManager);
if (!builder.throwWhenStuckBuffering) {
player.experimentalDisableThrowWhenStuckBuffering();
}
sendRendererMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes); sendRendererMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes);
sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode); sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode);