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

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

Issue 2787703004: [Mojo Video Capture] Fix VideoCaptureManager exposing implementation details to clients (Closed)
Patch Set: Pull changes from upstream 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;
52 } 53 }
53 54
54 namespace url { 55 namespace url {
55 class Origin; 56 class Origin;
56 } 57 }
57 58
58 namespace content { 59 namespace content {
59 60
60 class AudioInputDeviceManager; 61 class AudioInputDeviceManager;
61 class FakeMediaStreamUIProxy; 62 class FakeMediaStreamUIProxy;
(...skipping 16 matching lines...) Expand all
78 79
79 // Callback for testing. 80 // Callback for testing.
80 typedef base::Callback<bool(const StreamControls&)> 81 typedef base::Callback<bool(const StreamControls&)>
81 GenerateStreamTestCallback; 82 GenerateStreamTestCallback;
82 83
83 // 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
84 // render processes hosts whose corresponding render processes are requesting 85 // render processes hosts whose corresponding render processes are requesting
85 // logging from webrtcLoggingPrivate API. Safe to call from any thread. 86 // logging from webrtcLoggingPrivate API. Safe to call from any thread.
86 static void SendMessageToNativeLog(const std::string& message); 87 static void SendMessageToNativeLog(const std::string& message);
87 88
88 explicit MediaStreamManager(media::AudioSystem* audio_system); 89 static std::unique_ptr<MediaStreamManager> CreateWithDefaults(
miu 2017/04/03 21:31:23 Perhaps include a comment about threading/task-run
chfremer 2017/04/04 21:59:32 I wouldn't know what to say here. As a reader, wha
90 media::AudioSystem* audio_system);
91
92 static std::unique_ptr<MediaStreamManager>
93 CreateWithCustomVideoCaptureDeviceTaskRunner(
miu 2017/04/03 21:31:23 Looks like nothing calls this. So, can we delete i
chfremer 2017/04/04 21:59:32 Done.
94 media::AudioSystem* audio_system,
95 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
96
97 static std::unique_ptr<MediaStreamManager> CreateWithCustomVideoCaptureSystem(
98 media::AudioSystem* audio_system,
99 std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
100 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
89 101
90 ~MediaStreamManager() override; 102 ~MediaStreamManager() override;
91 103
92 // Used to access VideoCaptureManager. 104 // Used to access VideoCaptureManager.
93 VideoCaptureManager* video_capture_manager(); 105 VideoCaptureManager* video_capture_manager();
94 106
95 // Used to access AudioInputDeviceManager. 107 // Used to access AudioInputDeviceManager.
96 AudioInputDeviceManager* audio_input_device_manager(); 108 AudioInputDeviceManager* audio_input_device_manager();
97 109
98 // Used to access MediaDevicesManager. 110 // Used to access MediaDevicesManager.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 private: 282 private:
271 // Contains all data needed to keep track of requests. 283 // Contains all data needed to keep track of requests.
272 class DeviceRequest; 284 class DeviceRequest;
273 285
274 // |DeviceRequests| is a list to ensure requests are processed in the order 286 // |DeviceRequests| is a list to ensure requests are processed in the order
275 // they arrive. The first member of the pair is the label of the 287 // they arrive. The first member of the pair is the label of the
276 // |DeviceRequest|. 288 // |DeviceRequest|.
277 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>; 289 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>;
278 using DeviceRequests = std::list<LabeledDeviceRequest>; 290 using DeviceRequests = std::list<LabeledDeviceRequest>;
279 291
280 // Initializes the device managers on IO thread. Auto-starts the device 292 explicit MediaStreamManager(media::AudioSystem* audio_system);
281 // thread and registers this as a listener with the device managers. 293 void InitializeWithDefaults();
282 void InitializeDeviceManagersOnIOThread(); 294 void InitializeWithCustomVideoCaptureDeviceTaskRunner(
295 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
296 void InitializeWithCustomVideoCaptureSystem(
297 std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
298 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
299 void PerformCommonInitializationRoutines();
283 300
284 // |output_parameters| contains real values only if the request requires it. 301 // |output_parameters| contains real values only if the request requires it.
285 void HandleAccessRequestResponse( 302 void HandleAccessRequestResponse(
286 const std::string& label, 303 const std::string& label,
287 const media::AudioParameters& output_parameters, 304 const media::AudioParameters& output_parameters,
288 const MediaStreamDevices& devices, 305 const MediaStreamDevices& devices,
289 content::MediaStreamRequestResult result); 306 content::MediaStreamRequestResult result);
290 void StopMediaStreamFromBrowser(const std::string& label); 307 void StopMediaStreamFromBrowser(const std::string& label);
291 308
292 // Helpers. 309 // Helpers.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 440 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
424 441
425 GenerateStreamTestCallback generate_stream_test_callback_; 442 GenerateStreamTestCallback generate_stream_test_callback_;
426 443
427 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 444 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
428 }; 445 };
429 446
430 } // namespace content 447 } // namespace content
431 448
432 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 449 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698