Chromium Code Reviews| 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 afa3a0563b8dd3211b7c43de121540f4eb793b8b..5f5e4d9a1e5e3d1bc46ac1c19511b48cbc10096f 100644 |
| --- a/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
| +++ b/webrtc/api/android/java/src/org/webrtc/VideoCapturer.java |
| @@ -21,6 +21,7 @@ public interface VideoCapturer { |
| // Notify if the camera have been started successfully or not. |
| // Called on a Java thread owned by VideoCapturer. |
| void onCapturerStarted(boolean success); |
| + void onCapturerStopped(); |
| // Delivers a captured frame. Called on a Java thread owned by VideoCapturer. |
| void onByteBufferFrameCaptured(byte[] data, int width, int height, int rotation, |
| @@ -53,6 +54,9 @@ public interface VideoCapturer { |
| } |
| @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, |
| @@ -82,6 +86,57 @@ public interface VideoCapturer { |
| int width, int height, int framerate); |
| } |
| + // An implementation of CapturerObserver that forwards all calls from |
| + // Java to the C layer. |
| + static class AndroidVideoTrackSourceObserver implements CapturerObserver { |
| + // Pointer to AndroidVideoTrackSource |
|
magjed_webrtc
2016/07/19 12:57:46
super nit: dot at end of sentence.
sakal
2016/07/19 13:46:23
Done, this comment was actually outdated, fixed.
|
| + private final long nativeSource; |
| + |
| + public AndroidVideoTrackSourceObserver(long nativeSource) { |
| + this.nativeSource = nativeSource; |
| + } |
| + |
| + @Override |
| + public void onCapturerStarted(boolean success) { |
| + nativeCapturerStarted(nativeSource, success); |
| + } |
| + |
| + @Override |
| + public void onCapturerStopped() { |
| + nativeCapturerStopped(nativeSource); |
| + } |
| + |
| + @Override |
| + public void onByteBufferFrameCaptured(byte[] data, int width, int height, |
| + int rotation, long timeStamp) { |
| + nativeOnByteBufferFrameCaptured(nativeSource, data, data.length, width, height, rotation, |
| + timeStamp); |
| + } |
| + |
| + @Override |
| + public void onTextureFrameCaptured( |
| + int width, int height, int oesTextureId, float[] transformMatrix, int rotation, |
| + long timestamp) { |
| + nativeOnTextureFrameCaptured(nativeSource, width, height, oesTextureId, transformMatrix, |
| + rotation, timestamp); |
| + } |
| + |
| + @Override |
| + public void onOutputFormatRequest(int width, int height, int framerate) { |
| + nativeOnOutputFormatRequest(nativeSource, width, height, framerate); |
| + } |
| + |
| + private native void nativeCapturerStarted(long nativeSource, |
| + boolean success); |
| + private native void nativeCapturerStopped(long nativeSource); |
| + private native void nativeOnByteBufferFrameCaptured(long nativeSource, |
| + byte[] data, int length, int width, int height, int rotation, long timeStamp); |
| + private native void nativeOnTextureFrameCaptured(long nativeSource, int width, int height, |
| + int oesTextureId, float[] transformMatrix, int rotation, long timestamp); |
| + private native void nativeOnOutputFormatRequest(long nativeSource, |
| + int width, int height, int framerate); |
| + } |
| + |
| /** |
| * Returns a list with all the formats this VideoCapturer supports. |
| */ |