| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 678 } |
| 679 bitmapTextureFramebuffer.setSize(scaledWidth, scaledHeight); | 679 bitmapTextureFramebuffer.setSize(scaledWidth, scaledHeight); |
| 680 | 680 |
| 681 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, bitmapTextureFramebuffer.g
etFrameBufferId()); | 681 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, bitmapTextureFramebuffer.g
etFrameBufferId()); |
| 682 GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTAC
HMENT0, | 682 GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTAC
HMENT0, |
| 683 GLES20.GL_TEXTURE_2D, bitmapTextureFramebuffer.getTextureId(), 0); | 683 GLES20.GL_TEXTURE_2D, bitmapTextureFramebuffer.getTextureId(), 0); |
| 684 | 684 |
| 685 GLES20.glClearColor(0 /* red */, 0 /* green */, 0 /* blue */, 0 /* alpha *
/); | 685 GLES20.glClearColor(0 /* red */, 0 /* green */, 0 /* blue */, 0 /* alpha *
/); |
| 686 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); | 686 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); |
| 687 if (isYuvBuffer) { | 687 if (isYuvBuffer) { |
| 688 drawer.drawYuv(yuvTextures, | 688 listenerAndParams.drawer.drawYuv(yuvTextures, |
| 689 RendererCommon.convertMatrixFromAndroidGraphicsMatrix(drawMatrix), | 689 RendererCommon.convertMatrixFromAndroidGraphicsMatrix(drawMatrix), |
| 690 frame.getRotatedWidth(), frame.getRotatedHeight(), 0, 0, scaledWidth
, scaledHeight); | 690 frame.getRotatedWidth(), frame.getRotatedHeight(), 0, 0, scaledWidth
, scaledHeight); |
| 691 } else { | 691 } else { |
| 692 VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) fram
e.getBuffer(); | 692 VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) fram
e.getBuffer(); |
| 693 drawer.drawTexture(textureBuffer, drawMatrix, frame.getRotatedWidth(), | 693 listenerAndParams.drawer.drawTexture(textureBuffer, drawMatrix, frame.ge
tRotatedWidth(), |
| 694 frame.getRotatedHeight(), 0, 0, scaledWidth, scaledHeight); | 694 frame.getRotatedHeight(), 0, 0, scaledWidth, scaledHeight); |
| 695 } | 695 } |
| 696 | 696 |
| 697 final ByteBuffer bitmapBuffer = ByteBuffer.allocateDirect(scaledWidth * sc
aledHeight * 4); | 697 final ByteBuffer bitmapBuffer = ByteBuffer.allocateDirect(scaledWidth * sc
aledHeight * 4); |
| 698 GLES20.glViewport(0, 0, scaledWidth, scaledHeight); | 698 GLES20.glViewport(0, 0, scaledWidth, scaledHeight); |
| 699 GLES20.glReadPixels( | 699 GLES20.glReadPixels( |
| 700 0, 0, scaledWidth, scaledHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BY
TE, bitmapBuffer); | 700 0, 0, scaledWidth, scaledHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BY
TE, bitmapBuffer); |
| 701 | 701 |
| 702 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); | 702 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); |
| 703 GlUtil.checkNoGLES2Error("EglRenderer.notifyCallbacks"); | 703 GlUtil.checkNoGLES2Error("EglRenderer.notifyCallbacks"); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 729 + " Average swapBuffer time: " | 729 + " Average swapBuffer time: " |
| 730 + averageTimeAsString(renderSwapBufferTimeNs, framesRendered) + "."); | 730 + averageTimeAsString(renderSwapBufferTimeNs, framesRendered) + "."); |
| 731 resetStatistics(currentTimeNs); | 731 resetStatistics(currentTimeNs); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 private void logD(String string) { | 735 private void logD(String string) { |
| 736 Logging.d(TAG, name + string); | 736 Logging.d(TAG, name + string); |
| 737 } | 737 } |
| 738 } | 738 } |
| OLD | NEW |