OLD | NEW |
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/enumerate media capture devices (video | 5 // MediaStreamManager is used to open/enumerate media capture devices (video |
6 // supported now). Call flow: | 6 // supported 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void NotifyDevicesChanged(MediaStreamType stream_type, | 239 void NotifyDevicesChanged(MediaStreamType stream_type, |
240 const StreamDeviceInfoArray& devices); | 240 const StreamDeviceInfoArray& devices); |
241 | 241 |
242 void HandleAccessRequestResponse(const std::string& label, | 242 void HandleAccessRequestResponse(const std::string& label, |
243 const MediaStreamDevices& devices, | 243 const MediaStreamDevices& devices, |
244 content::MediaStreamRequestResult result); | 244 content::MediaStreamRequestResult result); |
245 void StopMediaStreamFromBrowser(const std::string& label); | 245 void StopMediaStreamFromBrowser(const std::string& label); |
246 | 246 |
247 void DoEnumerateDevices(const std::string& label); | 247 void DoEnumerateDevices(const std::string& label); |
248 | 248 |
249 // Enumerates audio output devices. No caching. | |
250 void EnumerateAudioOutputDevices(const std::string& label); | |
251 | |
252 void AudioOutputDevicesEnumerated(const StreamDeviceInfoArray& devices); | |
253 | |
254 // Helpers. | 249 // Helpers. |
255 // Checks if all devices that was requested in the request identififed by | 250 // Checks if all devices that was requested in the request identififed by |
256 // |label| has been opened and set the request state accordingly. | 251 // |label| has been opened and set the request state accordingly. |
257 void HandleRequestDone(const std::string& label, | 252 void HandleRequestDone(const std::string& label, |
258 DeviceRequest* request); | 253 DeviceRequest* request); |
259 // Stop the use of the device associated with |session_id| of type |type| in | 254 // Stop the use of the device associated with |session_id| of type |type| in |
260 // all |requests_|. The device is removed from the request. If a request | 255 // all |requests_|. The device is removed from the request. If a request |
261 /// doesn't use any devices as a consequence, the request is deleted. | 256 /// doesn't use any devices as a consequence, the request is deleted. |
262 void StopDevice(MediaStreamType type, int session_id); | 257 void StopDevice(MediaStreamType type, int session_id); |
263 // Calls the correct capture manager and close the device with |session_id|. | 258 // Calls the correct capture manager and close the device with |session_id|. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // the webrtcLoggingPrivate API if requested. | 346 // the webrtcLoggingPrivate API if requested. |
352 void AddLogMessageOnUIThread(const std::set<int>& render_process_ids, | 347 void AddLogMessageOnUIThread(const std::set<int>& render_process_ids, |
353 const std::string& message); | 348 const std::string& message); |
354 | 349 |
355 // Handles the callback from MediaStreamUIProxy to receive the UI window id, | 350 // Handles the callback from MediaStreamUIProxy to receive the UI window id, |
356 // used for excluding the notification window in desktop capturing. | 351 // used for excluding the notification window in desktop capturing. |
357 void OnMediaStreamUIWindowId(MediaStreamType video_type, | 352 void OnMediaStreamUIWindowId(MediaStreamType video_type, |
358 StreamDeviceInfoArray devices, | 353 StreamDeviceInfoArray devices, |
359 gfx::NativeViewId window_id); | 354 gfx::NativeViewId window_id); |
360 | 355 |
361 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and | 356 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager. |
362 // used for enumerating audio output devices. | |
363 // Note: Enumeration tasks may take seconds to complete so must never be run | 357 // Note: Enumeration tasks may take seconds to complete so must never be run |
364 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. | 358 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. |
365 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 359 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
366 | 360 |
367 media::AudioManager* const audio_manager_; // not owned | 361 media::AudioManager* const audio_manager_; // not owned |
368 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 362 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
369 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 363 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
370 | 364 |
371 // Indicator of device monitoring state. | 365 // Indicator of device monitoring state. |
372 bool monitoring_started_; | 366 bool monitoring_started_; |
(...skipping 16 matching lines...) Expand all Loading... |
389 | 383 |
390 bool use_fake_ui_; | 384 bool use_fake_ui_; |
391 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 385 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
392 | 386 |
393 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 387 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
394 }; | 388 }; |
395 | 389 |
396 } // namespace content | 390 } // namespace content |
397 | 391 |
398 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 392 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |