OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 @Override | 676 @Override |
677 public void onTextureFrameAvailable( | 677 public void onTextureFrameAvailable( |
678 int oesTextureId, float[] transformMatrix, long timestampNs) { | 678 int oesTextureId, float[] transformMatrix, long timestampNs) { |
679 checkIsOnCameraThread(); | 679 checkIsOnCameraThread(); |
680 if (camera == null) { | 680 if (camera == null) { |
681 // Camera is stopped, we need to return the buffer immediately. | 681 // Camera is stopped, we need to return the buffer immediately. |
682 surfaceHelper.returnTextureFrame(); | 682 surfaceHelper.returnTextureFrame(); |
683 return; | 683 return; |
684 } | 684 } |
685 if (dropNextFrame) { | 685 if (dropNextFrame) { |
686 surfaceHelper.returnTextureFrame(); | 686 surfaceHelper.returnTextureFrame(); |
687 dropNextFrame = false; | 687 dropNextFrame = false; |
688 return; | 688 return; |
| 689 } |
| 690 if (eventsHandler != null && !firstFrameReported) { |
| 691 eventsHandler.onFirstFrameAvailable(); |
| 692 firstFrameReported = true; |
689 } | 693 } |
690 | 694 |
691 int rotation = getFrameOrientation(); | 695 int rotation = getFrameOrientation(); |
692 if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT) { | 696 if (info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT) { |
693 // Undo the mirror that the OS "helps" us with. | 697 // Undo the mirror that the OS "helps" us with. |
694 // http://developer.android.com/reference/android/hardware/Camera.html#set
DisplayOrientation(int) | 698 // http://developer.android.com/reference/android/hardware/Camera.html#set
DisplayOrientation(int) |
695 transformMatrix = | 699 transformMatrix = |
696 RendererCommon.multiplyMatrices(transformMatrix, RendererCommon.horizo
ntalFlipMatrix()); | 700 RendererCommon.multiplyMatrices(transformMatrix, RendererCommon.horizo
ntalFlipMatrix()); |
697 } | 701 } |
698 cameraStatistics.addFrame(); | 702 cameraStatistics.addFrame(); |
699 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig
ht, oesTextureId, | 703 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig
ht, oesTextureId, |
700 transformMatrix, rotation, timestampNs); | 704 transformMatrix, rotation, timestampNs); |
701 } | 705 } |
702 } | 706 } |
OLD | NEW |