Throw errors from WebvttPlaybackTest.stallUntilPlayerCondition
Before this change, if a playback error is thrown the test fails with a
timeout and no additional info:
```
java.util.concurrent.TimeoutException
at androidx.media3.exoplayer.e2etest.WebvttPlaybackTest.stallPlayerUntilCondition(WebvttPlaybackTest.java:361)
```
After this change, the test failure includes a much more useful stack
trace, e.g. from 0352db9a37
:
```
Caused by: java.lang.IllegalStateException: Legacy decoding is disabled, can't handle text/vtt samples (expected application/x-media3-cues).
at androidx.media3.common.util.Assertions.checkState(Assertions.java:100)
at androidx.media3.exoplayer.text.TextRenderer.assertLegacyDecodingEnabledIfRequired(TextRenderer.java:587)
at androidx.media3.exoplayer.text.TextRenderer.onStreamChanged(TextRenderer.java:210)
```
PiperOrigin-RevId: 634672138
This commit is contained in:
parent
d83e81f374
commit
282a944eb4
@ -354,7 +354,9 @@ public class WebvttPlaybackTest {
|
|||||||
private static void stallPlayerUntilCondition(ExoPlayer player, AtomicBoolean condition)
|
private static void stallPlayerUntilCondition(ExoPlayer player, AtomicBoolean condition)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
long timeoutTimeMs = Clock.DEFAULT.currentTimeMillis() + RobolectricUtil.DEFAULT_TIMEOUT_MS;
|
long timeoutTimeMs = Clock.DEFAULT.currentTimeMillis() + RobolectricUtil.DEFAULT_TIMEOUT_MS;
|
||||||
while (!condition.get()) {
|
while (!condition.get()
|
||||||
|
&& (player.getPlaybackState() == Player.STATE_READY
|
||||||
|
|| player.getPlaybackState() == Player.STATE_BUFFERING)) {
|
||||||
// Trigger more work at the current time until the condition is fulfilled.
|
// Trigger more work at the current time until the condition is fulfilled.
|
||||||
if (Clock.DEFAULT.currentTimeMillis() >= timeoutTimeMs) {
|
if (Clock.DEFAULT.currentTimeMillis() >= timeoutTimeMs) {
|
||||||
throw new TimeoutException();
|
throw new TimeoutException();
|
||||||
@ -363,5 +365,8 @@ public class WebvttPlaybackTest {
|
|||||||
player.play();
|
player.play();
|
||||||
run(player).untilPendingCommandsAreFullyHandled();
|
run(player).untilPendingCommandsAreFullyHandled();
|
||||||
}
|
}
|
||||||
|
if (player.getPlayerError() != null) {
|
||||||
|
throw player.getPlayerError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user