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

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: Rebase to April 5 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 18 matching lines...) Expand all
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 explicit MediaStreamManager(media::AudioSystem* audio_system);
89 90
91 // |audio_system| is required but defaults will be used if either
92 // |video_capture_system| or |device_task_runner| are null.
93 explicit MediaStreamManager(
94 media::AudioSystem* audio_system,
95 std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
96 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
97
90 ~MediaStreamManager() override; 98 ~MediaStreamManager() override;
91 99
92 // Used to access VideoCaptureManager. 100 // Used to access VideoCaptureManager.
93 VideoCaptureManager* video_capture_manager(); 101 VideoCaptureManager* video_capture_manager();
94 102
95 // Used to access AudioInputDeviceManager. 103 // Used to access AudioInputDeviceManager.
96 AudioInputDeviceManager* audio_input_device_manager(); 104 AudioInputDeviceManager* audio_input_device_manager();
97 105
98 // Used to access MediaDevicesManager. 106 // Used to access MediaDevicesManager.
99 MediaDevicesManager* media_devices_manager(); 107 MediaDevicesManager* media_devices_manager();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 private: 274 private:
267 // Contains all data needed to keep track of requests. 275 // Contains all data needed to keep track of requests.
268 class DeviceRequest; 276 class DeviceRequest;
269 277
270 // |DeviceRequests| is a list to ensure requests are processed in the order 278 // |DeviceRequests| is a list to ensure requests are processed in the order
271 // they arrive. The first member of the pair is the label of the 279 // they arrive. The first member of the pair is the label of the
272 // |DeviceRequest|. 280 // |DeviceRequest|.
273 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>; 281 using LabeledDeviceRequest = std::pair<std::string, DeviceRequest*>;
274 using DeviceRequests = std::list<LabeledDeviceRequest>; 282 using DeviceRequests = std::list<LabeledDeviceRequest>;
275 283
276 // Initializes the device managers on IO thread. Auto-starts the device 284 void InitializeMaybeAsync(
277 // thread and registers this as a listener with the device managers. 285 std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
278 void InitializeDeviceManagersOnIOThread(); 286 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner);
279 287
280 // |output_parameters| contains real values only if the request requires it. 288 // |output_parameters| contains real values only if the request requires it.
281 void HandleAccessRequestResponse( 289 void HandleAccessRequestResponse(
282 const std::string& label, 290 const std::string& label,
283 const media::AudioParameters& output_parameters, 291 const media::AudioParameters& output_parameters,
284 const MediaStreamDevices& devices, 292 const MediaStreamDevices& devices,
285 content::MediaStreamRequestResult result); 293 content::MediaStreamRequestResult result);
286 void StopMediaStreamFromBrowser(const std::string& label); 294 void StopMediaStreamFromBrowser(const std::string& label);
287 295
288 // Helpers. 296 // Helpers.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; 426 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_;
419 427
420 GenerateStreamTestCallback generate_stream_test_callback_; 428 GenerateStreamTestCallback generate_stream_test_callback_;
421 429
422 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 430 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
423 }; 431 };
424 432
425 } // namespace content 433 } // namespace content
426 434
427 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 435 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698