Change default value of throwWhenStuckBuffering to true.
This change caused no problems and can be enabled by default. PiperOrigin-RevId: 325264859
This commit is contained in:
parent
092c66fac3
commit
eee9b312dc
@ -215,6 +215,7 @@ public interface ExoPlayer extends Player {
|
|||||||
useLazyPreparation = true;
|
useLazyPreparation = true;
|
||||||
seekParameters = SeekParameters.DEFAULT;
|
seekParameters = SeekParameters.DEFAULT;
|
||||||
clock = Clock.DEFAULT;
|
clock = Clock.DEFAULT;
|
||||||
|
throwWhenStuckBuffering = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -411,8 +412,8 @@ public interface ExoPlayer extends Player {
|
|||||||
if (releaseTimeoutMs > 0) {
|
if (releaseTimeoutMs > 0) {
|
||||||
player.experimental_setReleaseTimeoutMs(releaseTimeoutMs);
|
player.experimental_setReleaseTimeoutMs(releaseTimeoutMs);
|
||||||
}
|
}
|
||||||
if (throwWhenStuckBuffering) {
|
if (!throwWhenStuckBuffering) {
|
||||||
player.experimental_throwWhenStuckBuffering();
|
player.experimental_disableThrowWhenStuckBuffering();
|
||||||
}
|
}
|
||||||
|
|
||||||
return player;
|
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
|
* <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.
|
* only be called before the player is used.
|
||||||
*/
|
*/
|
||||||
public void experimental_throwWhenStuckBuffering() {
|
public void experimental_disableThrowWhenStuckBuffering() {
|
||||||
internalPlayer.experimental_throwWhenStuckBuffering();
|
internalPlayer.experimental_disableThrowWhenStuckBuffering();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -224,6 +224,7 @@ 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();
|
||||||
|
|
||||||
@ -257,8 +258,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
this.releaseTimeoutMs = releaseTimeoutMs;
|
this.releaseTimeoutMs = releaseTimeoutMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void experimental_throwWhenStuckBuffering() {
|
public void experimental_disableThrowWhenStuckBuffering() {
|
||||||
throwWhenStuckBuffering = true;
|
throwWhenStuckBuffering = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void experimental_enableOffloadScheduling(boolean enableOffloadScheduling) {
|
public void experimental_enableOffloadScheduling(boolean enableOffloadScheduling) {
|
||||||
|
@ -206,6 +206,7 @@ public class SimpleExoPlayer extends BasePlayer
|
|||||||
useLazyPreparation = true;
|
useLazyPreparation = true;
|
||||||
seekParameters = SeekParameters.DEFAULT;
|
seekParameters = SeekParameters.DEFAULT;
|
||||||
clock = Clock.DEFAULT;
|
clock = Clock.DEFAULT;
|
||||||
|
throwWhenStuckBuffering = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -618,8 +619,8 @@ 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) {
|
if (!builder.throwWhenStuckBuffering) {
|
||||||
player.experimental_throwWhenStuckBuffering();
|
player.experimental_disableThrowWhenStuckBuffering();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendRendererMessage(C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_AUDIO_ATTRIBUTES, audioAttributes);
|
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.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentMatcher;
|
import org.mockito.ArgumentMatcher;
|
||||||
@ -4588,8 +4587,6 @@ public final class ExoPlayerTest {
|
|||||||
testRunner.blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
|
testRunner.blockUntilActionScheduleFinished(TIMEOUT_MS).blockUntilEnded(TIMEOUT_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled until the flag to throw exceptions for [internal: b/144538905] is enabled by default.
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void loadControlNeverWantsToLoad_throwsIllegalStateException() {
|
public void loadControlNeverWantsToLoad_throwsIllegalStateException() {
|
||||||
LoadControl neverLoadingLoadControl =
|
LoadControl neverLoadingLoadControl =
|
||||||
@ -4697,7 +4694,6 @@ public final class ExoPlayerTest {
|
|||||||
new TestExoPlayer.Builder(context)
|
new TestExoPlayer.Builder(context)
|
||||||
.setRenderers(rendererWaitingForData)
|
.setRenderers(rendererWaitingForData)
|
||||||
.setLoadControl(loadControlWithMaxBufferUs)
|
.setLoadControl(loadControlWithMaxBufferUs)
|
||||||
.experimental_setThrowWhenStuckBuffering(true)
|
|
||||||
.build();
|
.build();
|
||||||
player.setMediaSource(mediaSourceWithLoadInProgress);
|
player.setMediaSource(mediaSourceWithLoadInProgress);
|
||||||
player.prepare();
|
player.prepare();
|
||||||
@ -7334,8 +7330,6 @@ public final class ExoPlayerTest {
|
|||||||
assertThat(positionAfterPause.get()).isEqualTo(10_000);
|
assertThat(positionAfterPause.get()).isEqualTo(10_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabled until the flag to throw exceptions for [internal: b/144538905] is enabled by default.
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void
|
public void
|
||||||
infiniteLoading_withSmallAllocations_oomIsPreventedByLoadControl_andThrowsStuckBufferingIllegalStateException() {
|
infiniteLoading_withSmallAllocations_oomIsPreventedByLoadControl_andThrowsStuckBufferingIllegalStateException() {
|
||||||
|
@ -61,7 +61,6 @@ public class TestExoPlayer {
|
|||||||
@Nullable private Renderer[] renderers;
|
@Nullable private Renderer[] renderers;
|
||||||
@Nullable private RenderersFactory renderersFactory;
|
@Nullable private RenderersFactory renderersFactory;
|
||||||
private boolean useLazyPreparation;
|
private boolean useLazyPreparation;
|
||||||
private boolean throwWhenStuckBuffering;
|
|
||||||
private @MonotonicNonNull Looper looper;
|
private @MonotonicNonNull Looper looper;
|
||||||
|
|
||||||
public Builder(Context context) {
|
public Builder(Context context) {
|
||||||
@ -231,19 +230,6 @@ public class TestExoPlayer {
|
|||||||
return looper;
|
return looper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
* Builds an {@link SimpleExoPlayer} using the provided values or their defaults.
|
||||||
*
|
*
|
||||||
@ -278,7 +264,6 @@ public class TestExoPlayer {
|
|||||||
.setClock(clock)
|
.setClock(clock)
|
||||||
.setUseLazyPreparation(useLazyPreparation)
|
.setUseLazyPreparation(useLazyPreparation)
|
||||||
.setLooper(looper)
|
.setLooper(looper)
|
||||||
.experimental_setThrowWhenStuckBuffering(throwWhenStuckBuffering)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user