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 552a0f224d..51e8f69679 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 @@ -135,6 +135,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); }