Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/CameraVideoCapturer.java

Issue 2844233002: Revert of Support adding and removing MediaRecorder to camera 2 session. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 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
11 package org.webrtc; 11 package org.webrtc;
12 12
13 import android.media.MediaRecorder;
14
15 /** 13 /**
16 * Base interface for camera1 and camera2 implementations. Extends VideoCapturer with a 14 * Base interface for camera1 and camera2 implementations. Extends VideoCapturer with a
17 * switchCamera() function. Also provides subinterfaces for handling camera even ts, and a helper 15 * switchCamera() function. Also provides subinterfaces for handling camera even ts, and a helper
18 * class for detecting camera freezes. 16 * class for detecting camera freezes.
19 */ 17 */
20 public interface CameraVideoCapturer extends VideoCapturer { 18 public interface CameraVideoCapturer extends VideoCapturer {
21 /** 19 /**
22 * Camera events handler - can be used to be notifed about camera events. The callbacks are 20 * Camera events handler - can be used to be notifed about camera events. The callbacks are
23 * executed from an arbitrary thread. 21 * executed from an arbitrary thread.
24 */ 22 */
(...skipping 30 matching lines...) Expand all
55 void onCameraSwitchError(String errorDescription); 53 void onCameraSwitchError(String errorDescription);
56 } 54 }
57 55
58 /** 56 /**
59 * Switch camera to the next valid camera id. This can only be called while th e camera is running. 57 * Switch camera to the next valid camera id. This can only be called while th e camera is running.
60 * This function can be called from any thread. 58 * This function can be called from any thread.
61 */ 59 */
62 void switchCamera(CameraSwitchHandler switchEventsHandler); 60 void switchCamera(CameraSwitchHandler switchEventsHandler);
63 61
64 /** 62 /**
65 * MediaRecorder add/remove handler - one of these functions are invoked with the result of
66 * addMediaRecorderToCamera() or removeMediaRecorderFromCamera calls.
67 * The callback may be called on an arbitrary thread.
68 */
69 public interface MediaRecorderHandler {
70 // Invoked on success.
71 void onMediaRecorderSuccess();
72
73 // Invoked on failure, e.g. camera is stopped or any exception happens.
74 void onMediaRecorderError(String errorDescription);
75 }
76
77 /**
78 * Add MediaRecorder to camera pipeline. This can only be called while the cam era is running.
79 * Once MediaRecorder is added to camera pipeline camera switch is not allowed .
80 * This function can be called from any thread.
81 */
82 void addMediaRecorderToCamera(MediaRecorder mediaRecorder, MediaRecorderHandle r resultHandler);
83
84 /**
85 * Remove MediaRecorder from camera pipeline. This can only be called while th e camera is running.
86 * This function can be called from any thread.
87 */
88 void removeMediaRecorderFromCamera(MediaRecorderHandler resultHandler);
89
90 /**
91 * Helper class to log framerate and detect if the camera freezes. It will run periodic callbacks 63 * Helper class to log framerate and detect if the camera freezes. It will run periodic callbacks
92 * on the SurfaceTextureHelper thread passed in the ctor, and should only be o perated from that 64 * on the SurfaceTextureHelper thread passed in the ctor, and should only be o perated from that
93 * thread. 65 * thread.
94 */ 66 */
95 public static class CameraStatistics { 67 public static class CameraStatistics {
96 private final static String TAG = "CameraStatistics"; 68 private final static String TAG = "CameraStatistics";
97 private final static int CAMERA_OBSERVER_PERIOD_MS = 2000; 69 private final static int CAMERA_OBSERVER_PERIOD_MS = 2000;
98 private final static int CAMERA_FREEZE_REPORT_TIMOUT_MS = 4000; 70 private final static int CAMERA_FREEZE_REPORT_TIMOUT_MS = 4000;
99 71
100 private final SurfaceTextureHelper surfaceTextureHelper; 72 private final SurfaceTextureHelper surfaceTextureHelper;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 public void addFrame() { 121 public void addFrame() {
150 checkThread(); 122 checkThread();
151 ++frameCount; 123 ++frameCount;
152 } 124 }
153 125
154 public void release() { 126 public void release() {
155 surfaceTextureHelper.getHandler().removeCallbacks(cameraObserver); 127 surfaceTextureHelper.getHandler().removeCallbacks(cameraObserver);
156 } 128 }
157 } 129 }
158 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698