Expose functionality to convert TextureBuffer to I420.
Bug: webrtc:8392
Change-Id: I79682efbef3aecbba904aa5047b229833fae25e8
Reviewed-on: https://webrtc-review.googlesource.com/8940
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20313}
diff --git a/sdk/android/api/org/webrtc/VideoFileRenderer.java b/sdk/android/api/org/webrtc/VideoFileRenderer.java
index 17676c0..bb6ebaa 100644
--- a/sdk/android/api/org/webrtc/VideoFileRenderer.java
+++ b/sdk/android/api/org/webrtc/VideoFileRenderer.java
@@ -15,8 +15,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.concurrent.CountDownLatch;
import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
/**
* Can be used to save the video frames to file.
@@ -94,7 +94,7 @@
final float[] texMatrix = RendererCommon.multiplyMatrices(rotatedSamplingMatrix, layoutMatrix);
try {
- ByteBuffer buffer = nativeCreateNativeByteBuffer(outputFrameSize);
+ ByteBuffer buffer = JniCommon.allocateNativeByteBuffer(outputFrameSize);
if (!frame.yuvFrame) {
yuvConverter.convert(outputFrameBuffer, outputFileWidth, outputFileHeight, outputFileWidth,
frame.textureId, texMatrix);
@@ -153,7 +153,7 @@
videoOutFile.write(data);
- nativeFreeNativeByteBuffer(buffer);
+ JniCommon.freeNativeByteBuffer(buffer);
}
videoOutFile.close();
Logging.d(TAG, "Video written to disk as " + outputFileName + ". Number frames are "
@@ -167,8 +167,4 @@
public static native void nativeI420Scale(ByteBuffer srcY, int strideY, ByteBuffer srcU,
int strideU, ByteBuffer srcV, int strideV, int width, int height, ByteBuffer dst,
int dstWidth, int dstHeight);
-
- public static native ByteBuffer nativeCreateNativeByteBuffer(int size);
-
- public static native void nativeFreeNativeByteBuffer(ByteBuffer buffer);
}