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

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.h

Issue 2803483003: [Mojo Video Capture] Split interface BuildableVideoCaptureDevice (Closed)
Patch Set: Remove fallback mechanism. Created 3 years, 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/process/process_handle.h" 18 #include "base/process/process_handle.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "base/timer/elapsed_timer.h" 20 #include "base/timer/elapsed_timer.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "content/browser/renderer_host/media/media_stream_provider.h" 22 #include "content/browser/renderer_host/media/media_stream_provider.h"
23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 23 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
24 #include "content/browser/renderer_host/media/video_capture_device_launch_observ er.h"
24 #include "content/browser/renderer_host/media/video_capture_provider.h" 25 #include "content/browser/renderer_host/media/video_capture_provider.h"
25 #include "content/common/content_export.h" 26 #include "content/common/content_export.h"
26 #include "content/common/media/media_stream_options.h" 27 #include "content/common/media/media_stream_options.h"
27 #include "media/base/video_facing.h" 28 #include "media/base/video_facing.h"
28 #include "media/capture/video/video_capture_device.h" 29 #include "media/capture/video/video_capture_device.h"
29 #include "media/capture/video/video_capture_device_info.h" 30 #include "media/capture/video/video_capture_device_info.h"
30 #include "media/capture/video_capture_types.h" 31 #include "media/capture/video_capture_types.h"
31 32
32 #if defined(OS_ANDROID) 33 #if defined(OS_ANDROID)
33 #include "base/android/application_status_listener.h" 34 #include "base/android/application_status_listener.h"
34 #endif 35 #endif
35 36
36 namespace content { 37 namespace content {
37 class VideoCaptureController; 38 class VideoCaptureController;
38 class VideoCaptureControllerEventHandler; 39 class VideoCaptureControllerEventHandler;
39 40
40 // VideoCaptureManager is used to open/close, start/stop, enumerate available 41 // VideoCaptureManager is used to open/close, start/stop, enumerate available
41 // video capture devices, and manage VideoCaptureController's. 42 // video capture devices, and manage VideoCaptureController's.
42 // In its main usage in production, an instance is created by MediaStreamManager 43 // In its main usage in production, an instance is created by MediaStreamManager
43 // on the Browser::IO thread. All public methods are expected to be called from 44 // on the Browser::IO thread. All public methods are expected to be called from
44 // the Browser::IO thread. A device can only be opened once. 45 // the Browser::IO thread. A device can only be opened once.
45 class CONTENT_EXPORT VideoCaptureManager 46 class CONTENT_EXPORT VideoCaptureManager
46 : public MediaStreamProvider, 47 : public MediaStreamProvider,
47 public BuildableVideoCaptureDevice::Callbacks { 48 public VideoCaptureDeviceLaunchObserver {
48 public: 49 public:
49 using VideoCaptureDevice = media::VideoCaptureDevice; 50 using VideoCaptureDevice = media::VideoCaptureDevice;
50 51
51 // Callback used to signal the completion of a controller lookup. 52 // Callback used to signal the completion of a controller lookup.
52 using DoneCB = 53 using DoneCB =
53 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>; 54 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>;
54 55
55 explicit VideoCaptureManager( 56 explicit VideoCaptureManager(
56 std::unique_ptr<VideoCaptureProvider> video_capture_provider); 57 std::unique_ptr<VideoCaptureProvider> video_capture_provider);
57 58
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // is hidden, see http://crbug.com/582295. 172 // is hidden, see http://crbug.com/582295.
172 void OnApplicationStateChange(base::android::ApplicationState state); 173 void OnApplicationStateChange(base::android::ApplicationState state);
173 #endif 174 #endif
174 175
175 using EnumerationCallback = 176 using EnumerationCallback =
176 base::Callback<void(const media::VideoCaptureDeviceDescriptors&)>; 177 base::Callback<void(const media::VideoCaptureDeviceDescriptors&)>;
177 // Asynchronously obtains descriptors for the available devices. 178 // Asynchronously obtains descriptors for the available devices.
178 // As a side-effect, updates |devices_info_cache_|. 179 // As a side-effect, updates |devices_info_cache_|.
179 void EnumerateDevices(const EnumerationCallback& client_callback); 180 void EnumerateDevices(const EnumerationCallback& client_callback);
180 181
181 // Implementation of BuildableVideoCaptureDevice::Callbacks: 182 // VideoCaptureDeviceLaunchObserver implementation:
182 void OnDeviceStarted(VideoCaptureController* controller) override; 183 void OnDeviceLaunched(VideoCaptureController* controller) override;
183 void OnDeviceStartFailed(VideoCaptureController* controller) override; 184 void OnDeviceLaunchFailed(VideoCaptureController* controller) override;
184 void OnDeviceStartAborted() override; 185 void OnDeviceLaunchAborted() override;
185 186
186 // Retrieves camera calibration information for a particular device. Returns 187 // Retrieves camera calibration information for a particular device. Returns
187 // nullopt_t if the |device_id| is not found or camera calibration information 188 // nullopt_t if the |device_id| is not found or camera calibration information
188 // is not available for the device. Camera calibration is cached during 189 // is not available for the device. Camera calibration is cached during
189 // device(s) enumeration. 190 // device(s) enumeration.
190 base::Optional<CameraCalibration> GetCameraCalibration( 191 base::Optional<CameraCalibration> GetCameraCalibration(
191 const std::string& device_id); 192 const std::string& device_id);
192 193
193 private: 194 private:
194 class CaptureDeviceStartRequest; 195 class CaptureDeviceStartRequest;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Map used by DesktopCapture. 296 // Map used by DesktopCapture.
296 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> 297 std::map<media::VideoCaptureSessionId, gfx::NativeViewId>
297 notification_window_ids_; 298 notification_window_ids_;
298 299
299 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); 300 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager);
300 }; 301 };
301 302
302 } // namespace content 303 } // namespace content
303 304
304 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 305 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698