| Index: talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
|
| diff --git a/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java b/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
|
| index 5195044a827a374b346fcfae41210312de660a5d..667128ef362ec7d1bdd24c81b81a322badb03f9f 100644
|
| --- a/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
|
| +++ b/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
|
| @@ -61,36 +61,31 @@ public class RendererCommon {
|
| // The minimum fraction of the frame content that will be shown for |SCALE_ASPECT_BALANCED|.
|
| // This limits excessive cropping when adjusting display size.
|
| private static float BALANCED_VISIBLE_FRACTION = 0.5625f;
|
| + public static final float[] IDENTITY_MATRIX = new float[] {
|
| + 1, 0, 0, 0,
|
| + 0, 1, 0, 0,
|
| + 0, 0, 1, 0,
|
| + 0, 0, 0, 1
|
| + };
|
| // Matrix with transform y' = 1 - y.
|
| - private static final float[] VERTICAL_FLIP = new float[] {
|
| + public static final float[] VERTICAL_FLIP = new float[] {
|
| 1, 0, 0, 0,
|
| 0, -1, 0, 0,
|
| 0, 0, 1, 0,
|
| 0, 1, 0, 1};
|
|
|
| /**
|
| - * Returns 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. If the video source is based on
|
| - * ByteBuffers, pass null in |surfaceTexture|.
|
| + * Rotates |textureMatrix| with |rotationDegree| and returns it in a new matrix. The rotation is
|
| + * done around (0.5, 0.5) to work with textures sampled from 0.0 to 1.0.
|
| */
|
| - public static float[] getSamplingMatrix(SurfaceTexture surfaceTexture, float rotationDegree) {
|
| - final float[] samplingMatrix;
|
| - if (surfaceTexture == null) {
|
| - // For ByteBuffers, row 0 specifies the top row, but for a texture, row 0 specifies the
|
| - // bottom row. Flip the image vertically to compensate for this.
|
| - samplingMatrix = VERTICAL_FLIP;
|
| - } else {
|
| - samplingMatrix = new float[16];
|
| - surfaceTexture.getTransformMatrix(samplingMatrix);
|
| - }
|
| + public static float[] rotateTextureMatrix(float[] textureMatrix, float rotationDegree) {
|
| // Clockwise rotation matrix in the XY-plane (around the Z-axis).
|
| final float[] rotationMatrix = new float[16];
|
| Matrix.setRotateM(rotationMatrix, 0, rotationDegree, 0, 0, 1);
|
| adjustOrigin(rotationMatrix);
|
| // Multiply matrices together.
|
| final float[] tmpMatrix = new float[16];
|
| - Matrix.multiplyMM(tmpMatrix, 0, samplingMatrix, 0, rotationMatrix, 0);
|
| + Matrix.multiplyMM(tmpMatrix, 0, textureMatrix, 0, rotationMatrix, 0);
|
| return tmpMatrix;
|
| }
|
|
|
|
|