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

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

Issue 1357923002: wip Move SurfaceTexture.updateTexImage() from video renderers into MediaCodecVideoDecoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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/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..b771d5fb63818b01e0ffa61a00c6b4cc1aa4bdd9 100644
--- a/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
+++ b/talk/app/webrtc/java/android/org/webrtc/RendererCommon.java
@@ -61,36 +61,25 @@ 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;
- // 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 static final float[] IDENTITY_MATRIX = new float[] {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 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;
}

Powered by Google App Engine
This is Rietveld 408576698