From 07fe60710c3768aa3e8f76e0feb8731fb671b38f Mon Sep 17 00:00:00 2001 From: claincly Date: Fri, 13 Jan 2023 17:02:58 +0000 Subject: [PATCH] Fix not able to set a null output surface. Previously, after calling MCVR.setOutput() with null, `frameProcessorManager`'s output surface is cleared. What was unexpected is `ExoPlayerInternal` notifies a zero output resolution after clearing the output surface. This zero resolution causes FrameProcessor to fail. PiperOrigin-RevId: 501861993 --- .../android/exoplayer2/video/MediaCodecVideoRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java index 751aff5794..56cc4af916 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/video/MediaCodecVideoRenderer.java @@ -682,7 +682,10 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { break; case MSG_SET_VIDEO_OUTPUT_RESOLUTION: Size outputResolution = (Size) checkNotNull(message); - if (displaySurface != null && frameProcessorManager.isEnabled()) { + if (outputResolution.getWidth() != 0 + && outputResolution.getHeight() != 0 + && displaySurface != null + && frameProcessorManager.isEnabled()) { frameProcessorManager.setOutputSurfaceInfo(displaySurface, outputResolution); } break; @@ -2047,6 +2050,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { checkNotNull(frameProcessor).setOutputSurfaceInfo(null); currentSurfaceAndSize = null; } + /** * Sets the input surface info. *