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

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

Issue 2800493002: [Mojo Video Capture] Create abstraction VideoCaptureProvider (Closed)
Patch Set: Incorporated suggestions from PatchSet 2 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 // MediaStreamManager is used to open media capture devices (video supported 5 // MediaStreamManager is used to open media capture devices (video supported
6 // now). Call flow: 6 // now). Call flow:
7 // 1. GenerateStream is called when a render process wants to use a capture 7 // 1. GenerateStream is called when a render process wants to use a capture
8 // device. 8 // device.
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/browser/renderer_host/media/media_devices_manager.h" 42 #include "content/browser/renderer_host/media/media_devices_manager.h"
43 #include "content/browser/renderer_host/media/media_stream_provider.h" 43 #include "content/browser/renderer_host/media/media_stream_provider.h"
44 #include "content/common/content_export.h" 44 #include "content/common/content_export.h"
45 #include "content/common/media/media_devices.h" 45 #include "content/common/media/media_devices.h"
46 #include "content/common/media/media_stream_options.h" 46 #include "content/common/media/media_stream_options.h"
47 #include "content/public/browser/media_request_state.h" 47 #include "content/public/browser/media_request_state.h"
48 #include "media/base/video_facing.h" 48 #include "media/base/video_facing.h"
49 49
50 namespace media { 50 namespace media {
51 class AudioSystem; 51 class AudioSystem;
52 class VideoCaptureSystem;
53 } 52 }
54 53
55 namespace url { 54 namespace url {
56 class Origin; 55 class Origin;
57 } 56 }
58 57
59 namespace content { 58 namespace content {
60 59
61 class AudioInputDeviceManager; 60 class AudioInputDeviceManager;
62 class FakeMediaStreamUIProxy; 61 class FakeMediaStreamUIProxy;
63 class MediaStreamRequester; 62 class MediaStreamRequester;
64 class MediaStreamUIProxy; 63 class MediaStreamUIProxy;
65 class VideoCaptureManager; 64 class VideoCaptureManager;
65 class VideoCaptureProvider;
66 66
67 // MediaStreamManager is used to generate and close new media devices, not to 67 // MediaStreamManager is used to generate and close new media devices, not to
68 // start the media flow. The classes requesting new media streams are answered 68 // start the media flow. The classes requesting new media streams are answered
69 // using MediaStreamRequester. 69 // using MediaStreamRequester.
70 class CONTENT_EXPORT MediaStreamManager 70 class CONTENT_EXPORT MediaStreamManager
71 : public MediaStreamProviderListener, 71 : public MediaStreamProviderListener,
72 public base::MessageLoop::DestructionObserver, 72 public base::MessageLoop::DestructionObserver,
73 public base::PowerObserver { 73 public base::PowerObserver {
74 public: 74 public:
75 // Callback to deliver the result of a media request. 75 // Callback to deliver the result of a media request.
76 typedef base::Callback<void(const MediaStreamDevices& devices, 76 typedef base::Callback<void(const MediaStreamDevices& devices,
77 std::unique_ptr<MediaStreamUIProxy> ui)> 77 std::unique_ptr<MediaStreamUIProxy> ui)>
78 MediaRequestResponseCallback; 78 MediaRequestResponseCallback;
79 79
80 // Callback for testing. 80 // Callback for testing.
81 typedef base::Callback<bool(const StreamControls&)> 81 typedef base::Callback<bool(const StreamControls&)>
82 GenerateStreamTestCallback; 82 GenerateStreamTestCallback;
83 83
84 // Adds |message| to native logs for outstanding device requests, for use by 84 // Adds |message| to native logs for outstanding device requests, for use by
85 // render processes hosts whose corresponding render processes are requesting 85 // render processes hosts whose corresponding render processes are requesting
86 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 86 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
87 static void SendMessageToNativeLog(const std::string& message); 87 static void SendMessageToNativeLog(const std::string& message);
88 88
89 explicit MediaStreamManager(media::AudioSystem* audio_system); 89 explicit MediaStreamManager(media::AudioSystem* audio_system);
90 90
91 // |audio_system| is required but defaults will be used if either 91 // |audio_system| is required but defaults will be used if either
92 // |video_capture_system| or |device_task_runner| are null. 92 // |video_capture_system| or |device_task_runner| are null.
93 explicit MediaStreamManager( 93 explicit MediaStreamManager(
94 media::AudioSystem* audio_system, 94 media::AudioSystem* audio_system,
95 std::unique_ptr<media::VideoCaptureSystem> video_capture_system, 95 std::unique_ptr<VideoCaptureProvider> video_capture_provider);
96 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
97 96
98 ~MediaStreamManager() override; 97 ~MediaStreamManager() override;
99 98
100 // Used to access VideoCaptureManager. 99 // Used to access VideoCaptureManager.
101 VideoCaptureManager* video_capture_manager(); 100 VideoCaptureManager* video_capture_manager();
102 101
103 // Used to access AudioInputDeviceManager. 102 // Used to access AudioInputDeviceManager.
104 AudioInputDeviceManager* audio_input_device_manager(); 103 AudioInputDeviceManager* audio_input_device_manager();
105 104
106 // Used to access MediaDevicesManager. 105 // Used to access MediaDevicesManager.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Contains all data needed to keep track of requests. 274 // Contains all data needed to keep track of requests.
276 class DeviceRequest; 275 class DeviceRequest;
277 276
278 // |DeviceRequests| is a list to ensure requests are processed in the order 277 // |DeviceRequests| is a list to ensure requests are processed in the order
279 // they arrive. The first member of the pair is the label of the 278 // they arrive. The first member of the pair is the label of the
280 // |DeviceRequest|. 279 // |DeviceRequest|.
281 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>; 280 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>;
282 using DeviceRequests = std::list<LabeledDeviceRequest>; 281 using DeviceRequests = std::list<LabeledDeviceRequest>;
283 282
284 void InitializeMaybeAsync( 283 void InitializeMaybeAsync(
285 std::unique_ptr<media::VideoCaptureSystem> video_capture_system, 284 std::unique_ptr<VideoCaptureProvider> video_capture_provider);
286 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
287 285
288 // |output_parameters| contains real values only if the request requires it. 286 // |output_parameters| contains real values only if the request requires it.
289 void HandleAccessRequestResponse( 287 void HandleAccessRequestResponse(
290 const std::string& label, 288 const std::string& label,
291 const media::AudioParameters& output_parameters, 289 const media::AudioParameters& output_parameters,
292 const MediaStreamDevices& devices, 290 const MediaStreamDevices& devices,
293 content::MediaStreamRequestResult result); 291 content::MediaStreamRequestResult result);
294 void StopMediaStreamFromBrowser(const std::string& label); 292 void StopMediaStreamFromBrowser(const std::string& label);
295 293
296 // Helpers. 294 // Helpers.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 424 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
427 425
428 GenerateStreamTestCallback generate_stream_test_callback_; 426 GenerateStreamTestCallback generate_stream_test_callback_;
429 427
430 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 428 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
431 }; 429 };
432 430
433 } // namespace content 431 } // namespace content
434 432
435 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 433 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698