From 492dfeb0c7108938f030e7fbf01371144034e034 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 --- .../media3/exoplayer/video/MediaCodecVideoRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java index a182268fa5..e4989329a2 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java @@ -686,7 +686,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; @@ -2051,6 +2054,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { checkNotNull(frameProcessor).setOutputSurfaceInfo(null); currentSurfaceAndSize = null; } + /** * Sets the input surface info. *