Commit eee9b312 by tonihei Committed by kim-vde

Change default value of throwWhenStuckBuffering to true.

This change caused no problems and can be enabled by default.

PiperOrigin-RevId: 325264859
parent 092c66fa
......@@ -215,6 +215,7 @@ public interface ExoPlayer extends Player {
useLazyPreparation = true;
seekParameters = SeekParameters.DEFAULT;
clock = Clock.DEFAULT;
throwWhenStuckBuffering = true;
}
/**
......@@ -411,8 +412,8 @@ public interface ExoPlayer extends Player {
if (releaseTimeoutMs > 0) {
player.experimental_setReleaseTimeoutMs(releaseTimeoutMs);
}
if (throwWhenStuckBuffering) {
player.experimental_throwWhenStuckBuffering();
if (!throwWhenStuckBuffering) {
player.experimental_disableThrowWhenStuckBuffering();
}
return player;
......
......@@ -200,13 +200,13 @@ import java.util.concurrent.TimeoutException;
}
/**
* Configures the player to throw when it detects it's stuck buffering.
* 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 experimental_throwWhenStuckBuffering() {
internalPlayer.experimental_throwWhenStuckBuffering();
public void experimental_disableThrowWhenStuckBuffering() {
internalPlayer.experimental_disableThrowWhenStuckBuffering();
}
@Override
......
......@@ -224,6 +224,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
this.pauseAtEndOfWindow = pauseAtEndOfWindow;
this.clock = clock;
throwWhenStuckBuffering = true;
backBufferDurationUs = loadControl.getBackBufferDurationUs();
retainBackBufferFromKeyframe = loadControl.retainBackBufferFromKeyframe();
......@@ -257,8 +258,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
this.releaseTimeoutMs = releaseTimeoutMs;
}
public void experimental_throwWhenStuckBuffering() {
throwWhenStuckBuffering = true;
public void experimental_disableThrowWhenStuckBuffering() {
throwWhenStuckBuffering = false;
}
public void experimental_enableOffloadScheduling(boolean enableOffloadScheduling) {
......
......@@ -206,6 +206,7 @@ public class SimpleExoPlayer extends BasePlayer
useLazyPreparation = true;
seekParameters = SeekParameters.DEFAULT;
clock = Clock.DEFAULT;
throwWhenStuckBuffering = true;
}
/**
......@@ -618,8 +619,8 @@ 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.experimental_throwWhenStuckBuffering();
if (!builder.throwWhenStuckBuffering) {
player.experimental_disableThrowWhenStuckBuffering();
}
sendRendererMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes);
......
......@@ -115,7 +115,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatcher;
......@@ -4588,8 +4587,6 @@ public final class ExoPlayerTest {
testRunner.blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
}
// Disabled until the flag to throw exceptions for [internal: b/144538905] is enabled by default.
@Ignore
@Test
public void loadControlNeverWantsToLoad_throwsIllegalStateException() {
LoadControl neverLoadingLoadControl =
......@@ -4697,7 +4694,6 @@ public final class ExoPlayerTest {
new TestExoPlayer.Builder(context)
.setRenderers(rendererWaitingForData)
.setLoadControl(loadControlWithMaxBufferUs)
.experimental_setThrowWhenStuckBuffering(true)
.build();
player.setMediaSource(mediaSourceWithLoadInProgress);
player.prepare();
......@@ -7334,8 +7330,6 @@ public final class ExoPlayerTest {
assertThat(positionAfterPause.get()).isEqualTo(10_000);
}
// Disabled until the flag to throw exceptions for [internal: b/144538905] is enabled by default.
@Ignore
@Test
public void
infiniteLoading_withSmallAllocations_oomIsPreventedByLoadControl_andThrowsStuckBufferingIllegalStateException() {
......
......@@ -61,7 +61,6 @@ public class TestExoPlayer {
@Nullable private Renderer[] renderers;
@Nullable private RenderersFactory renderersFactory;
private boolean useLazyPreparation;
private boolean throwWhenStuckBuffering;
private @MonotonicNonNull Looper looper;
public Builder(Context context) {
......@@ -232,19 +231,6 @@ public class TestExoPlayer {
}
/**
* 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 experimental_setThrowWhenStuckBuffering(boolean throwWhenStuckBuffering) {
this.throwWhenStuckBuffering = throwWhenStuckBuffering;
return this;
}
/**
* Builds an {@link SimpleExoPlayer} using the provided values or their defaults.
*
* @return The built {@link ExoPlayerTestRunner}.
......@@ -278,7 +264,6 @@ public class TestExoPlayer {
.setClock(clock)
.setUseLazyPreparation(useLazyPreparation)
.setLooper(looper)
.experimental_setThrowWhenStuckBuffering(throwWhenStuckBuffering)
.build();
}
}
......
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