Add support for RGB frames in MediaCodecVideoEncoder.

BUG=webrtc:7749

Review-Url: https://codereview.webrtc.org/3002263002
Cr-Commit-Position: refs/heads/master@{#19554}
This commit is contained in:
sakal 2017-08-28 02:41:38 -07:00 committed by Commit Bot
parent ef423d4298
commit 160e32c34f
2 changed files with 8 additions and 4 deletions

View File

@ -616,10 +616,8 @@ public class MediaCodecVideoEncoder {
// TODO(perkj): glClear() shouldn't be necessary since every pixel is covered anyway,
// but it's a workaround for bug webrtc:5147.
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
drawer.drawOes(textureBuffer.getTextureId(),
RendererCommon.convertMatrixFromAndroidGraphicsMatrix(
textureBuffer.getTransformMatrix()),
width, height, 0, 0, width, height);
drawer.drawTexture(textureBuffer, new Matrix() /* renderMatrix */, width, height,
0 /* viewportX */, 0 /* viewportY */, width, height);
eglBase.swapBuffers(frame.getTimestampNs());
} else {
VideoFrame.I420Buffer i420Buffer = buffer.toI420();

View File

@ -48,6 +48,12 @@ public class RendererCommon {
void drawYuv(int[] yuvTextures, float[] texMatrix, int frameWidth, int frameHeight,
int viewportX, int viewportY, int viewportWidth, int viewportHeight);
/**
* Draws a VideoFrame.TextureBuffer. Default implementation calls either drawOes or drawRgb
* depending on the type of the buffer. You can supply an additional render matrix. This is
* used multiplied together with the transformation matrix of the frame. (M = renderMatrix *
* transformationMatrix)
*/
default void
drawTexture(VideoFrame.TextureBuffer buffer, android.graphics.Matrix renderMatrix,
int frameWidth, int frameHeight, int viewportX, int viewportY, int viewportWidth,