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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 // Note that this actually opens the camera, and Camera callbacks run on the | 363 // Note that this actually opens the camera, and Camera callbacks run on the |
364 // thread that calls open(), so this is done on the CameraThread. | 364 // thread that calls open(), so this is done on the CameraThread. |
365 @Override | 365 @Override |
366 public void startCapture( | 366 public void startCapture( |
367 final int width, final int height, final int framerate, | 367 final int width, final int height, final int framerate, |
368 final SurfaceTextureHelper surfaceTextureHelper, final Context application
Context, | 368 final SurfaceTextureHelper surfaceTextureHelper, final Context application
Context, |
369 final CapturerObserver frameObserver) { | 369 final CapturerObserver frameObserver) { |
370 Logging.d(TAG, "startCapture requested: " + width + "x" + height + "@" + fra
merate); | 370 Logging.d(TAG, "startCapture requested: " + width + "x" + height + "@" + fra
merate); |
371 if (surfaceTextureHelper == null) { | 371 if (surfaceTextureHelper == null) { |
372 throw new IllegalArgumentException("surfaceTextureHelper not set."); | 372 frameObserver.onCapturerStarted(false /* success */); |
| 373 if (eventsHandler != null) { |
| 374 eventsHandler.onCameraError("No SurfaceTexture created."); |
| 375 } |
| 376 return; |
373 } | 377 } |
374 if (applicationContext == null) { | 378 if (applicationContext == null) { |
375 throw new IllegalArgumentException("applicationContext not set."); | 379 throw new IllegalArgumentException("applicationContext not set."); |
376 } | 380 } |
377 if (frameObserver == null) { | 381 if (frameObserver == null) { |
378 throw new IllegalArgumentException("frameObserver not set."); | 382 throw new IllegalArgumentException("frameObserver not set."); |
379 } | 383 } |
380 synchronized (handlerLock) { | 384 synchronized (handlerLock) { |
381 if (this.cameraThreadHandler != null) { | 385 if (this.cameraThreadHandler != null) { |
382 throw new RuntimeException("Camera has already been started."); | 386 throw new RuntimeException("Camera has already been started."); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // Undo the mirror that the OS "helps" us with. | 743 // Undo the mirror that the OS "helps" us with. |
740 // http://developer.android.com/reference/android/hardware/Camera.html#set
DisplayOrientation(int) | 744 // http://developer.android.com/reference/android/hardware/Camera.html#set
DisplayOrientation(int) |
741 transformMatrix = | 745 transformMatrix = |
742 RendererCommon.multiplyMatrices(transformMatrix, RendererCommon.horizo
ntalFlipMatrix()); | 746 RendererCommon.multiplyMatrices(transformMatrix, RendererCommon.horizo
ntalFlipMatrix()); |
743 } | 747 } |
744 cameraStatistics.addFrame(); | 748 cameraStatistics.addFrame(); |
745 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig
ht, oesTextureId, | 749 frameObserver.onTextureFrameCaptured(captureFormat.width, captureFormat.heig
ht, oesTextureId, |
746 transformMatrix, rotation, timestampNs); | 750 transformMatrix, rotation, timestampNs); |
747 } | 751 } |
748 } | 752 } |
OLD | NEW |