From 196a99aa5ff6e644a9f0276d67ca057f9bb1a73b Mon Sep 17 00:00:00 2001 From: hschlueter Date: Mon, 23 May 2022 18:37:04 +0100 Subject: [PATCH] Don't reallocate EGLSurface for same debug surface. Recreating an EGLSurface for a surface that already has an EGLSurface is not allowed according to the [documentation](https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglCreatePlatformWindowSurface.xhtml). This fix was tested on the devices listed in the bug description (Pixel 5a, Nexus 5). PiperOrigin-RevId: 450473569 --- .../androidx/media3/transformer/FrameProcessorChain.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java b/libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java index 7704ba2ce2..3e4d895933 100644 --- a/libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java +++ b/libraries/transformer/src/main/java/androidx/media3/transformer/FrameProcessorChain.java @@ -602,10 +602,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @Override public synchronized void surfaceChanged( SurfaceHolder holder, int format, int width, int height) { - surface = holder.getSurface(); - eglSurface = null; this.width = width; this.height = height; + Surface newSurface = holder.getSurface(); + if (surface == null || !surface.equals(newSurface)) { + surface = newSurface; + eglSurface = null; + } } @Override