diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 537e6e66bd..ad8395d024 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -91,6 +91,7 @@ * Add `TrackSelection.shouldCancelMediaChunkLoad` to check whether an ongoing load should be canceled. Only supported by HLS streams so far. ([#2848](https://github.com/google/ExoPlayer/issues/2848)). + * Remove throws clause from Renderer.stop. * Video: Pass frame rate hint to `Surface.setFrameRate` on Android R devices. * Track selection: * Add `Player.getTrackSelector`. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/BaseRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/BaseRenderer.java index fc2cbbce28..c26e12bcb7 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/BaseRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/BaseRenderer.java @@ -151,7 +151,7 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities { } @Override - public final void stop() throws ExoPlaybackException { + public final void stop() { Assertions.checkState(state == STATE_STARTED); state = STATE_ENABLED; onStopped(); @@ -255,12 +255,10 @@ public abstract class BaseRenderer implements Renderer, RendererCapabilities { /** * Called when the renderer is stopped. - *
- * The default implementation is a no-op. * - * @throws ExoPlaybackException If an error occurs. + *
The default implementation is a no-op. */ - protected void onStopped() throws ExoPlaybackException { + protected void onStopped() { // Do nothing. } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/NoSampleRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/NoSampleRenderer.java index 47ed8cec6a..46961d027f 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/NoSampleRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/NoSampleRenderer.java @@ -130,7 +130,7 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities } @Override - public final void stop() throws ExoPlaybackException { + public final void stop() { Assertions.checkState(state == STATE_STARTED); state = STATE_ENABLED; onStopped(); @@ -237,12 +237,10 @@ public abstract class NoSampleRenderer implements Renderer, RendererCapabilities /** * Called when the renderer is stopped. - *
- * The default implementation is a no-op. * - * @throws ExoPlaybackException If an error occurs. + *
The default implementation is a no-op. */ - protected void onStopped() throws ExoPlaybackException { + protected void onStopped() { // Do nothing. } diff --git a/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java b/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java index 8620c2d752..fdaa7d5cce 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/Renderer.java @@ -466,13 +466,11 @@ public interface Renderer extends PlayerMessage.Target { /** * Stops the renderer, transitioning it to the {@link #STATE_ENABLED} state. - *
- * This method may be called when the renderer is in the following states: - * {@link #STATE_STARTED}. * - * @throws ExoPlaybackException If an error occurs. + *
This method may be called when the renderer is in the following states: {@link
+ * #STATE_STARTED}.
*/
- void stop() throws ExoPlaybackException;
+ void stop();
/**
* Disable the renderer, transitioning it to the {@link #STATE_DISABLED} state.
diff --git a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java
index 9bcbce834a..3f09f71336 100644
--- a/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java
+++ b/library/core/src/test/java/com/google/android/exoplayer2/ExoPlayerTest.java
@@ -6089,69 +6089,6 @@ public final class ExoPlayerTest {
assertThat(trackSelectionsAfterError.get().get(1)).isNotNull(); // Audio renderer.
}
- @Test
- public void errorThrownDuringRendererDisableAtPeriodTransition_isReportedForCurrentPeriod() {
- FakeMediaSource source1 =
- new FakeMediaSource(
- new FakeTimeline(/* windowCount= */ 1), ExoPlayerTestRunner.VIDEO_FORMAT);
- FakeMediaSource source2 =
- new FakeMediaSource(
- new FakeTimeline(/* windowCount= */ 1), ExoPlayerTestRunner.AUDIO_FORMAT);
- FakeRenderer videoRenderer =
- new FakeRenderer(C.TRACK_TYPE_VIDEO) {
- @Override
- protected void onStopped() throws ExoPlaybackException {
- // Fail when stopping the renderer. This will happen during the period transition.
- throw createRendererException(
- new IllegalStateException(), ExoPlayerTestRunner.VIDEO_FORMAT);
- }
- };
- FakeRenderer audioRenderer = new FakeRenderer(C.TRACK_TYPE_AUDIO);
- AtomicReference