From 0bc6eb30bc09b4c49193229cf3c0de28341be6f4 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Wed, 22 Jun 2011 01:29:13 -0700 Subject: [PATCH] Fix the issue where TextureView stuck if the producer side is too fast. When SurfaceTexture is in sync mode, the consumer needs to pull the pending frames. Otherwise the onFrameAvailable won't be called and no more update. This simple fix is to skip frame to keep up with the producer side. Change-Id: Ica833695dc0b0221d2543f46f0dd41aa55d1aa16 --- core/jni/android_view_GLES20Canvas.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index e301e44c04bfd..22d3c6f444941 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -649,7 +649,8 @@ static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject cl float transform[16]; sp surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface)); - surfaceTexture->updateTexImage(); + while (surfaceTexture->getQueuedCount() > 0) + surfaceTexture->updateTexImage(); surfaceTexture->getTransformMatrix(transform); GLenum renderTarget = surfaceTexture->getCurrentTextureTarget();