From 1776e6e5b0f7660c26b38b77b8fcadbb9e099f1c Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Mon, 18 Jun 2018 01:36:06 -0700 Subject: [PATCH] Make no context current when releasing DummySurface This avoids a small native leak. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=200955086 --- .../com/google/android/exoplayer2/util/EGLSurfaceTexture.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/util/EGLSurfaceTexture.java b/library/core/src/main/java/com/google/android/exoplayer2/util/EGLSurfaceTexture.java index 6fe76b9b2c..19794365dd 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/util/EGLSurfaceTexture.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/util/EGLSurfaceTexture.java @@ -111,6 +111,10 @@ public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableL GLES20.glDeleteTextures(1, textureIdHolder, 0); } } finally { + if (display != null && !display.equals(EGL14.EGL_NO_DISPLAY)) { + EGL14.eglMakeCurrent( + display, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); + } if (surface != null && !surface.equals(EGL14.EGL_NO_SURFACE)) { EGL14.eglDestroySurface(display, surface); }