Fix potential tearing issue in VideoRendererGui.

This make sure that the texture copy is syncronized.

To reproduce the problem I:
Reverted "Revert of "Android MediaCodecVideoDecoder: Manage lifetime of texture frames" https://codereview.webrtc.org/1378033003/"
commit 543b6ca30a43eeb069c699291460ce6bacc7959d.
Reverted "Enable SurfaceViewRenderer for AppRTCDemo"
commit 7076729c57c27aa813760d2038be02c36f4d7649.
and ran ApprtDemo in loopback and changed the orientation a couple of times.

TBR=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1437823002

Cr-Commit-Position: refs/heads/master@{#10598}
This commit is contained in:
perkj
2015-11-11 03:38:35 -08:00
committed by Commit bot
parent 9cb8982e64
commit cbfabbf818

View File

@ -263,6 +263,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
// Restore normal framebuffer.
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
GLES20.glFinish();
}
copyTimeNs += (System.nanoTime() - now);
VideoRenderer.renderFrameDone(pendingFrame);
@ -299,7 +300,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
". Dropped: " + framesDropped + ". Rendered: " + framesRendered);
if (framesReceived > 0 && framesRendered > 0) {
Logging.d(TAG, "Duration: " + (int)(timeSinceFirstFrameNs / 1e6) +
" ms. FPS: " + (float)framesRendered * 1e9 / timeSinceFirstFrameNs);
" ms. FPS: " + framesRendered * 1e9 / timeSinceFirstFrameNs);
Logging.d(TAG, "Draw time: " +
(int) (drawTimeNs / (1000 * framesRendered)) + " us. Copy time: " +
(int) (copyTimeNs / (1000 * framesReceived)) + " us");
@ -483,6 +484,7 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
// rendering list.
final CountDownLatch countDownLatch = new CountDownLatch(1);
instance.surface.queueEvent(new Runnable() {
@Override
public void run() {
yuvImageRenderer.createTextures();
yuvImageRenderer.setScreenSize(