Android: Improve handling of RGB texture frames

In the transition period when we have both VideoRenderer.Callbacks and
VideoSinks, and VideoRenderer.I420Frames and VideoFrames, the adapters
between them does not handle RGB frames correctly. This CL improves the
situation somewhat, and at least gives clearer error messages.

BUG=webrtc:7749

Review-Url: https://codereview.webrtc.org/3017433002
Cr-Commit-Position: refs/heads/master@{#19817}
This commit is contained in:
magjed 2017-09-13 05:20:45 -07:00 committed by Commit Bot
parent dc80abe975
commit 2ab9879af0
2 changed files with 5 additions and 1 deletions

View File

@ -93,7 +93,8 @@ public class VideoRenderer {
if (rotationDegree % 90 != 0) {
throw new IllegalArgumentException("Rotation degree not multiple of 90: " + rotationDegree);
}
if (buffer instanceof VideoFrame.TextureBuffer) {
if (buffer instanceof VideoFrame.TextureBuffer
&& ((VideoFrame.TextureBuffer) buffer).getType() == VideoFrame.TextureBuffer.Type.OES) {
VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) buffer;
this.yuvFrame = false;
this.textureId = textureBuffer.getTextureId();

View File

@ -67,6 +67,9 @@ class TextureBufferImpl implements VideoFrame.TextureBuffer {
@Override
public VideoFrame.I420Buffer toI420() {
if (type == Type.RGB) {
throw new RuntimeException("toI420 for RGB frames not implemented yet");
}
// SurfaceTextureHelper requires a stride that is divisible by 8. Round width up.
// See SurfaceTextureHelper for details on the size and format.
int stride = ((width + 7) / 8) * 8;