Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1651)

Unified Diff: talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java

Issue 1394103005: Revert "Android MediaCodecVideoDecoder: Manage lifetime of texture frames" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Uncomment android capture code and add bug number Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
diff --git a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
index 1d413b8ece89d1a42cb6a7a89b6c371f9784c1d2..edb9fd69dcc416e93ced3c9fa55cd637d3c1a844 100644
--- a/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
+++ b/talk/app/webrtc/java/android/org/webrtc/VideoRendererGui.java
@@ -36,6 +36,7 @@ import javax.microedition.khronos.opengles.GL10;
import android.annotation.SuppressLint;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.SurfaceTexture;
import android.opengl.EGL14;
import android.opengl.EGLContext;
import android.opengl.GLES20;
@@ -245,15 +246,29 @@ public class VideoRendererGui implements GLSurfaceView.Renderer {
}
if (isNewFrame) {
- rotatedSamplingMatrix = RendererCommon.rotateTextureMatrix(
- pendingFrame.samplingMatrix, pendingFrame.rotationDegree);
if (pendingFrame.yuvFrame) {
rendererType = RendererType.RENDERER_YUV;
drawer.uploadYuvData(yuvTextures, pendingFrame.width, pendingFrame.height,
pendingFrame.yuvStrides, pendingFrame.yuvPlanes);
+ // The convention in WebRTC is that the first element in a ByteBuffer corresponds to the
+ // top-left corner of the image, but in glTexImage2D() the first element corresponds to
+ // the bottom-left corner. We correct this discrepancy by setting a vertical flip as
+ // sampling matrix.
+ final float[] samplingMatrix = RendererCommon.verticalFlipMatrix();
+ rotatedSamplingMatrix =
+ RendererCommon.rotateTextureMatrix(samplingMatrix, pendingFrame.rotationDegree);
} else {
rendererType = RendererType.RENDERER_TEXTURE;
- // External texture rendering. Make a deep copy of the external texture.
+ // External texture rendering. Update texture image to latest and make a deep copy of
+ // the external texture.
+ // TODO(magjed): Move updateTexImage() to the video source instead.
+ final SurfaceTexture surfaceTexture = (SurfaceTexture) pendingFrame.textureObject;
+ surfaceTexture.updateTexImage();
+ final float[] samplingMatrix = new float[16];
+ surfaceTexture.getTransformMatrix(samplingMatrix);
+ rotatedSamplingMatrix =
+ RendererCommon.rotateTextureMatrix(samplingMatrix, pendingFrame.rotationDegree);
+
// Reallocate offscreen texture if necessary.
textureCopy.setSize(pendingFrame.rotatedWidth(), pendingFrame.rotatedHeight());
« no previous file with comments | « talk/app/webrtc/java/android/org/webrtc/SurfaceViewRenderer.java ('k') | talk/app/webrtc/java/jni/androidmediadecoder_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698