From ccd61b1c1f3a88dba3fbd5bc1667165f97714d1d 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 --- .../exoplayer2/transformer/FrameProcessorChain.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/FrameProcessorChain.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/FrameProcessorChain.java index 304dcb4c34..0fb1389504 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/FrameProcessorChain.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/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