Index: webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
diff --git a/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java b/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
index 0ecc44f719182d54ca1dc8342cdc885763da66a3..c92f82ac18701694a23dafe62f0855d9199f3432 100644 |
--- a/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
+++ b/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
@@ -37,6 +37,53 @@ |
// by the camera will be scaled/or dropped by the video capturer. |
// Called on a Java thread owned by VideoCapturer. |
void onOutputFormatRequest(int width, int height, int framerate); |
+ } |
+ |
+ // An implementation of CapturerObserver that forwards all calls from |
+ // Java to the C layer. |
+ static class NativeObserver implements CapturerObserver { |
+ private final long nativeCapturer; |
+ |
+ public NativeObserver(long nativeCapturer) { |
+ this.nativeCapturer = nativeCapturer; |
+ } |
+ |
+ @Override |
+ public void onCapturerStarted(boolean success) { |
+ nativeCapturerStarted(nativeCapturer, success); |
+ } |
+ |
+ @Override |
+ public void onCapturerStopped() {} |
+ |
+ @Override |
+ public void onByteBufferFrameCaptured(byte[] data, int width, int height, |
+ int rotation, long timeStamp) { |
+ nativeOnByteBufferFrameCaptured(nativeCapturer, data, data.length, width, height, rotation, |
+ timeStamp); |
+ } |
+ |
+ @Override |
+ public void onTextureFrameCaptured( |
+ int width, int height, int oesTextureId, float[] transformMatrix, int rotation, |
+ long timestamp) { |
+ nativeOnTextureFrameCaptured(nativeCapturer, width, height, oesTextureId, transformMatrix, |
+ rotation, timestamp); |
+ } |
+ |
+ @Override |
+ public void onOutputFormatRequest(int width, int height, int framerate) { |
+ nativeOnOutputFormatRequest(nativeCapturer, width, height, framerate); |
+ } |
+ |
+ private native void nativeCapturerStarted(long nativeCapturer, |
+ boolean success); |
+ private native void nativeOnByteBufferFrameCaptured(long nativeCapturer, |
+ byte[] data, int length, int width, int height, int rotation, long timeStamp); |
+ private native void nativeOnTextureFrameCaptured(long nativeCapturer, int width, int height, |
+ int oesTextureId, float[] transformMatrix, int rotation, long timestamp); |
+ private native void nativeOnOutputFormatRequest(long nativeCapturer, |
+ int width, int height, int framerate); |
} |
// An implementation of CapturerObserver that forwards all calls from |