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

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

Issue 2634263002: Pass camera facing info to audio client (Closed)
Patch Set: Pass VideoCaptureObserver as ctor parameter Created 3 years, 11 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 // VideoCaptureManager is used to open/close, start/stop, enumerate available 5 // VideoCaptureManager is used to open/close, start/stop, enumerate available
6 // video capture devices, and manage VideoCaptureController's. 6 // video capture devices, and manage VideoCaptureController's.
7 // All functions are expected to be called from Browser::IO thread. Some helper 7 // All functions are expected to be called from Browser::IO thread. Some helper
8 // functions (*OnDeviceThread) will dispatch operations to the device thread. 8 // functions (*OnDeviceThread) will dispatch operations to the device thread.
9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice. 9 // VideoCaptureManager will open OS dependent instances of VideoCaptureDevice.
10 // A device can only be opened once. 10 // A device can only be opened once.
11 11
12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
14 14
15 #include <list> 15 #include <list>
16 #include <map> 16 #include <map>
17 #include <set> 17 #include <set>
18 #include <string> 18 #include <string>
19 19
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
23 #include "base/message_loop/message_loop.h" 23 #include "base/message_loop/message_loop.h"
24 #include "base/process/process_handle.h" 24 #include "base/process/process_handle.h"
25 #include "base/threading/thread_checker.h" 25 #include "base/threading/thread_checker.h"
26 #include "base/timer/elapsed_timer.h" 26 #include "base/timer/elapsed_timer.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "component/arc/video_facing.h"
28 #include "content/browser/renderer_host/media/media_stream_provider.h" 29 #include "content/browser/renderer_host/media/media_stream_provider.h"
29 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h" 30 #include "content/browser/renderer_host/media/video_capture_controller_event_han dler.h"
30 #include "content/common/content_export.h" 31 #include "content/common/content_export.h"
31 #include "content/common/media/media_stream_options.h" 32 #include "content/common/media/media_stream_options.h"
32 #include "media/capture/video/video_capture_device.h" 33 #include "media/capture/video/video_capture_device.h"
33 #include "media/capture/video/video_capture_device_factory.h" 34 #include "media/capture/video/video_capture_device_factory.h"
34 #include "media/capture/video_capture_types.h" 35 #include "media/capture/video_capture_types.h"
35 36
36 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
37 #include "base/android/application_status_listener.h" 38 #include "base/android/application_status_listener.h"
38 #endif 39 #endif
39 40
40 namespace content { 41 namespace content {
41 class VideoCaptureController; 42 class VideoCaptureController;
42 class VideoCaptureControllerEventHandler; 43 class VideoCaptureControllerEventHandler;
43 44
44 // VideoCaptureManager opens/closes and start/stops video capture devices. 45 // VideoCaptureManager opens/closes and start/stops video capture devices.
45 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider { 46 class CONTENT_EXPORT VideoCaptureManager : public MediaStreamProvider {
46 public: 47 public:
47 using VideoCaptureDevice = media::VideoCaptureDevice; 48 using VideoCaptureDevice = media::VideoCaptureDevice;
48 49
49 // Callback used to signal the completion of a controller lookup. 50 // Callback used to signal the completion of a controller lookup.
50 using DoneCB = 51 using DoneCB =
51 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>; 52 base::Callback<void(const base::WeakPtr<VideoCaptureController>&)>;
52 53
53 explicit VideoCaptureManager( 54 explicit VideoCaptureManager(
54 std::unique_ptr<media::VideoCaptureDeviceFactory> factory); 55 std::unique_ptr<media::VideoCaptureDeviceFactory> factory,
56 component::VideoCaptureObserver* observer);
55 57
56 void Unregister(); 58 void Unregister();
57 59
58 // Implements MediaStreamProvider. 60 // Implements MediaStreamProvider.
59 void Register(MediaStreamProviderListener* listener, 61 void Register(MediaStreamProviderListener* listener,
60 const scoped_refptr<base::SingleThreadTaskRunner>& 62 const scoped_refptr<base::SingleThreadTaskRunner>&
61 device_task_runner) override; 63 device_task_runner) override;
62 int Open(const StreamDeviceInfo& device) override; 64 int Open(const StreamDeviceInfo& device) override;
63 void Close(int capture_session_id) override; 65 void Close(int capture_session_id) override;
64 66
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // Queue to keep photo-associated requests waiting for a device to initialize, 318 // Queue to keep photo-associated requests waiting for a device to initialize,
317 // bundles a session id integer and an associated photo-related request. 319 // bundles a session id integer and an associated photo-related request.
318 std::list<std::pair<int, base::Callback<void(media::VideoCaptureDevice*)>>> 320 std::list<std::pair<int, base::Callback<void(media::VideoCaptureDevice*)>>>
319 photo_request_queue_; 321 photo_request_queue_;
320 322
321 // Device creation factory injected on construction from MediaStreamManager or 323 // Device creation factory injected on construction from MediaStreamManager or
322 // from the test harness. 324 // from the test harness.
323 std::unique_ptr<media::VideoCaptureDeviceFactory> 325 std::unique_ptr<media::VideoCaptureDeviceFactory>
324 video_capture_device_factory_; 326 video_capture_device_factory_;
325 327
328 component::VideoCaptureObserver* capture_observer_;
329
326 // Local cache of the enumerated video capture devices' names and capture 330 // Local cache of the enumerated video capture devices' names and capture
327 // supported formats. A snapshot of the current devices and their capabilities 331 // supported formats. A snapshot of the current devices and their capabilities
328 // is composed in VideoCaptureDeviceFactory::EnumerateDeviceNames() and 332 // is composed in VideoCaptureDeviceFactory::EnumerateDeviceNames() and
329 // ConsolidateDevicesInfoOnDeviceThread(), and this snapshot is used to update 333 // ConsolidateDevicesInfoOnDeviceThread(), and this snapshot is used to update
330 // this list in OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will 334 // this list in OnDevicesInfoEnumerated(). GetDeviceSupportedFormats() will
331 // use this list if the device is not started, otherwise it will retrieve the 335 // use this list if the device is not started, otherwise it will retrieve the
332 // active device capture format from the VideoCaptureController associated. 336 // active device capture format from the VideoCaptureController associated.
333 DeviceInfos devices_info_cache_; 337 DeviceInfos devices_info_cache_;
334 338
335 // Map used by DesktopCapture. 339 // Map used by DesktopCapture.
336 std::map<media::VideoCaptureSessionId, gfx::NativeViewId> 340 std::map<media::VideoCaptureSessionId, gfx::NativeViewId>
337 notification_window_ids_; 341 notification_window_ids_;
338 342
339 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager); 343 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManager);
340 }; 344 };
341 345
342 } // namespace content 346 } // namespace content
343 347
344 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_ 348 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698