| Index: talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
|
| diff --git a/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java b/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
|
| index afda84897cbe43b98548f219dfe6e8694a937ed0..0628d05f1218a391e3855ebc36aaa40590e70e5c 100644
|
| --- a/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
|
| +++ b/talk/app/webrtc/java/src/org/webrtc/VideoRenderer.java
|
| @@ -39,12 +39,23 @@ public class VideoRenderer {
|
|
|
| /** Java version of cricket::VideoFrame. Frames are only constructed from native code. */
|
| public static class I420Frame {
|
| + // Matrix with transform y' = 1 - y.
|
| + private static final float[] VERTICAL_FLIP = new float[] {
|
| + 1, 0, 0, 0,
|
| + 0, -1, 0, 0,
|
| + 0, 0, 1, 0,
|
| + 0, 1, 0, 1};
|
| +
|
| public final int width;
|
| public final int height;
|
| public final int[] yuvStrides;
|
| public ByteBuffer[] yuvPlanes;
|
| public final boolean yuvFrame;
|
| - public Object textureObject;
|
| + // Matrix that transforms standard coordinates to their proper sampling locations in
|
| + // the texture. This transform compensates for any properties of the video source that
|
| + // cause it to appear different from a normalized texture. This matrix does not take
|
| + // |rotationDegree| into account.
|
| + public final float[] samplingMatrix;
|
| public int textureId;
|
| // Frame pointer in C++.
|
| private long nativeFramePointer;
|
| @@ -65,6 +76,9 @@ public class VideoRenderer {
|
| this.yuvPlanes = yuvPlanes;
|
| this.yuvFrame = true;
|
| this.rotationDegree = rotationDegree;
|
| + // For ByteBuffers, row 0 specifies the top row, but for a texture, row 0 specifies the
|
| + // bottom row. Sample the texture with a vertical flip to compensate for this.
|
| + this.samplingMatrix = VERTICAL_FLIP;
|
| this.nativeFramePointer = nativeFramePointer;
|
| if (rotationDegree % 90 != 0) {
|
| throw new IllegalArgumentException("Rotation degree not multiple of 90: " + rotationDegree);
|
| @@ -76,12 +90,12 @@ public class VideoRenderer {
|
| */
|
| private I420Frame(
|
| int width, int height, int rotationDegree,
|
| - Object textureObject, int textureId, long nativeFramePointer) {
|
| + int textureId, float[] samplingMatrix, long nativeFramePointer) {
|
| this.width = width;
|
| this.height = height;
|
| this.yuvStrides = null;
|
| this.yuvPlanes = null;
|
| - this.textureObject = textureObject;
|
| + this.samplingMatrix = samplingMatrix;
|
| this.textureId = textureId;
|
| this.yuvFrame = false;
|
| this.rotationDegree = rotationDegree;
|
| @@ -124,7 +138,6 @@ public class VideoRenderer {
|
| */
|
| public static void renderFrameDone(I420Frame frame) {
|
| frame.yuvPlanes = null;
|
| - frame.textureObject = null;
|
| frame.textureId = 0;
|
| if (frame.nativeFramePointer != 0) {
|
| releaseNativeFrame(frame.nativeFramePointer);
|
|
|