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

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/RendererCommon.java

Issue 3002263002: Add support for RGB frames in MediaCodecVideoEncoder. (Closed)
Patch Set: Address comments. Created 3 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 unified diff | Download patch
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 30 matching lines...) Expand all
41 * implied by the current EGL context of the calling thread and requires no explicit argument. 41 * implied by the current EGL context of the calling thread and requires no explicit argument.
42 * The coordinates specify the viewport location on the surface target. 42 * The coordinates specify the viewport location on the surface target.
43 */ 43 */
44 void drawOes(int oesTextureId, float[] texMatrix, int frameWidth, int frameH eight, 44 void drawOes(int oesTextureId, float[] texMatrix, int frameWidth, int frameH eight,
45 int viewportX, int viewportY, int viewportWidth, int viewportHeight); 45 int viewportX, int viewportY, int viewportWidth, int viewportHeight);
46 void drawRgb(int textureId, float[] texMatrix, int frameWidth, int frameHeig ht, int viewportX, 46 void drawRgb(int textureId, float[] texMatrix, int frameWidth, int frameHeig ht, int viewportX,
47 int viewportY, int viewportWidth, int viewportHeight); 47 int viewportY, int viewportWidth, int viewportHeight);
48 void drawYuv(int[] yuvTextures, float[] texMatrix, int frameWidth, int frame Height, 48 void drawYuv(int[] yuvTextures, float[] texMatrix, int frameWidth, int frame Height,
49 int viewportX, int viewportY, int viewportWidth, int viewportHeight); 49 int viewportX, int viewportY, int viewportWidth, int viewportHeight);
50 50
51 /**
52 * Draws a VideoFrame.TextureBuffer. Default implementation calls either dra wOes or drawRgb
53 * depending on the type of the buffer. You can supply an additional render matrix. This is
54 * used multiplied together with the transformation matrix of the frame. (M = renderMatrix *
55 * transformationMatrix)
56 */
51 default void 57 default void
52 drawTexture(VideoFrame.TextureBuffer buffer, android.graphics.Matrix rende rMatrix, 58 drawTexture(VideoFrame.TextureBuffer buffer, android.graphics.Matrix rende rMatrix,
53 int frameWidth, int frameHeight, int viewportX, int viewportY, int vie wportWidth, 59 int frameWidth, int frameHeight, int viewportX, int viewportY, int vie wportWidth,
54 int viewportHeight) { 60 int viewportHeight) {
55 android.graphics.Matrix finalMatrix = 61 android.graphics.Matrix finalMatrix =
56 new android.graphics.Matrix(buffer.getTransformMatrix()); 62 new android.graphics.Matrix(buffer.getTransformMatrix());
57 finalMatrix.preConcat(renderMatrix); 63 finalMatrix.preConcat(renderMatrix);
58 float[] finalGlMatrix = convertMatrixFromAndroidGraphicsMatrix(finalMatr ix); 64 float[] finalGlMatrix = convertMatrixFromAndroidGraphicsMatrix(finalMatr ix);
59 switch (buffer.getType()) { 65 switch (buffer.getType()) {
60 case OES: 66 case OES:
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 return new Point(maxDisplayWidth, maxDisplayHeight); 389 return new Point(maxDisplayWidth, maxDisplayHeight);
384 } 390 }
385 // Each dimension is constrained on max display size and how much we are all owed to crop. 391 // Each dimension is constrained on max display size and how much we are all owed to crop.
386 final int width = Math.min( 392 final int width = Math.min(
387 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio)); 393 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio));
388 final int height = Math.min( 394 final int height = Math.min(
389 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio)); 395 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio));
390 return new Point(width, height); 396 return new Point(width, height);
391 } 397 }
392 } 398 }
OLDNEW
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/MediaCodecVideoEncoder.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698