diff --git a/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java index 1b69ffb4ec49..2df9a2b7d949 100644 --- a/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java +++ b/dom/media/systemservices/android_video_capture/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java @@ -187,15 +187,16 @@ public class VideoCaptureAndroid implements CameraVideoCapturer.CameraEventsHand // Delivers a captured frame. public void onFrameCaptured(VideoFrame frame) { - I420Buffer i420Buffer = frame.getBuffer().toI420(); + if (native_capturer != 0) { + I420Buffer i420Buffer = frame.getBuffer().toI420(); + ProvideCameraFrame(i420Buffer.getWidth(), i420Buffer.getHeight(), + i420Buffer.getDataY(), i420Buffer.getStrideY(), + i420Buffer.getDataU(), i420Buffer.getStrideU(), + i420Buffer.getDataV(), i420Buffer.getStrideV(), + frame.getRotation(), + frame.getTimestampNs() / 1000000, native_capturer); - ProvideCameraFrame(i420Buffer.getWidth(), i420Buffer.getHeight(), - i420Buffer.getDataY(), i420Buffer.getStrideY(), - i420Buffer.getDataU(), i420Buffer.getStrideU(), - i420Buffer.getDataV(), i420Buffer.getStrideV(), - frame.getRotation(), - frame.getTimestampNs() / 1000000, native_capturer); - - i420Buffer.release(); + i420Buffer.release(); + } } }