8000 Updating WebRTC lib 3 · CodeStrings/flutter-webrtc@36c9820 · GitHub
[go: up one dir, main page]

Skip to content

Commit 36c9820

Browse files
committed
Updating WebRTC lib 3
Fixed i420 rendering Still not handling rotation correctly
1 parent f7be98a commit 36c9820

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

android/src/main/java/com/cloudwebrtc/webrtc/SurfaceTextureRenderer.java

Lines changed: 6 additions & 4 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.webrtc.VideoFrame;
2222
import org.webrtc.VideoFrameDrawer;
2323
import org.webrtc.VideoSink;
24+
import org.webrtc.YuvHelper;
2425

2526
import java.nio.ByteBuffer;
2627

@@ -121,7 +122,7 @@ public int[] uploadYuvData(int width, int height, int[] strides, ByteBuffer[] pl
121122
}
122123
// Allocate copy buffer if necessary.
123124
if (copyCapacityNeeded > 0
124-
&& (copyBuffer == null || copyBuffer.capacity() < copyCapacityNeeded)) {
125+
&& (copyBuffer == null || copyBuffer.capacity() < copyCapacityNeeded)) {
125126
copyBuffer = ByteBuffer.allocateDirect(copyCapacityNeeded);
126127
}
127128
// Make sure YUV textures are allocated.
@@ -141,11 +142,12 @@ public int[] uploadYuvData(int width, int height, int[] strides, ByteBuffer[] pl
141142
// Input is packed already.
142143
packedByteBuffer = planes[i];
143144
} else {
144-
Log.e(TAG, "Unpacked YUV buffer found");
145-
throw new RuntimeException();
145+
YuvHelper.copyPlane(
146+
planes[i], strides[i], copyBuffer, planeWidths[i], planeWidths[i], planeHeights[i]);
147+
packedByteBuffer = copyBuffer;
146148
}
147149
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_LUMINANCE, planeWidths[i],
148-
planeHeights[i], 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, packedByteBuffer);
150+
planeHeights[i], 0, GLES20.GL_LUMINANCE, GLES20.GL_UNSIGNED_BYTE, packedByteBuffer);
149151
}
150152
return yuvTextures;
151153
}

0 commit comments

Comments
 (0)
0