| 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 21 matching lines...) Expand all Loading... |
| 32 #include <string> | 32 #include <string> |
| 33 #include <utility> | 33 #include <utility> |
| 34 #include <vector> | 34 #include <vector> |
| 35 | 35 |
| 36 #include "base/macros.h" | 36 #include "base/macros.h" |
| 37 #include "base/memory/ref_counted.h" | 37 #include "base/memory/ref_counted.h" |
| 38 #include "base/message_loop/message_loop.h" | 38 #include "base/message_loop/message_loop.h" |
| 39 #include "base/power_monitor/power_observer.h" | 39 #include "base/power_monitor/power_observer.h" |
| 40 #include "base/threading/thread.h" | 40 #include "base/threading/thread.h" |
| 41 #include "build/build_config.h" | 41 #include "build/build_config.h" |
| 42 #include "content/browser/renderer_host/media/audio_output_device_enumerator.h" | |
| 43 #include "content/browser/renderer_host/media/media_devices_manager.h" | 42 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 44 #include "content/browser/renderer_host/media/media_stream_provider.h" | 43 #include "content/browser/renderer_host/media/media_stream_provider.h" |
| 45 #include "content/common/content_export.h" | 44 #include "content/common/content_export.h" |
| 46 #include "content/common/media/media_devices.h" | 45 #include "content/common/media/media_devices.h" |
| 47 #include "content/common/media/media_stream_options.h" | 46 #include "content/common/media/media_stream_options.h" |
| 48 #include "content/public/browser/media_request_state.h" | 47 #include "content/public/browser/media_request_state.h" |
| 49 | 48 |
| 50 namespace media { | 49 namespace media { |
| 51 class AudioManager; | 50 class AudioManager; |
| 52 } | 51 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 explicit MediaStreamManager(media::AudioManager* audio_manager); | 86 explicit MediaStreamManager(media::AudioManager* audio_manager); |
| 88 | 87 |
| 89 ~MediaStreamManager() override; | 88 ~MediaStreamManager() override; |
| 90 | 89 |
| 91 // Used to access VideoCaptureManager. | 90 // Used to access VideoCaptureManager. |
| 92 VideoCaptureManager* video_capture_manager(); | 91 VideoCaptureManager* video_capture_manager(); |
| 93 | 92 |
| 94 // Used to access AudioInputDeviceManager. | 93 // Used to access AudioInputDeviceManager. |
| 95 AudioInputDeviceManager* audio_input_device_manager(); | 94 AudioInputDeviceManager* audio_input_device_manager(); |
| 96 | 95 |
| 97 // TODO(guidou): Remove when AudioRendererHost migrates to | |
| 98 // MediaDevicesManager. See http://crbug.com/647660. | |
| 99 // Used to access AudioOutputDeviceEnumerator. | |
| 100 AudioOutputDeviceEnumerator* audio_output_device_enumerator(); | |
| 101 | |
| 102 // Used to access MediaDevicesManager. | 96 // Used to access MediaDevicesManager. |
| 103 MediaDevicesManager* media_devices_manager(); | 97 MediaDevicesManager* media_devices_manager(); |
| 104 | 98 |
| 105 // Creates a new media access request which is identified by a unique string | 99 // Creates a new media access request which is identified by a unique string |
| 106 // that's returned to the caller. This will trigger the infobar and ask users | 100 // that's returned to the caller. This will trigger the infobar and ask users |
| 107 // for access to the device. |render_process_id| and |render_frame_id| are | 101 // for access to the device. |render_process_id| and |render_frame_id| are |
| 108 // used to determine where the infobar will appear to the user. |callback| is | 102 // used to determine where the infobar will appear to the user. |callback| is |
| 109 // used to send the selected device to the clients. An empty list of device | 103 // used to send the selected device to the clients. An empty list of device |
| 110 // will be returned if the users deny the access. | 104 // will be returned if the users deny the access. |
| 111 std::string MakeMediaAccessRequest( | 105 std::string MakeMediaAccessRequest( |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 425 |
| 432 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and | 426 // Task runner shared by VideoCaptureManager and AudioInputDeviceManager and |
| 433 // used for enumerating audio output devices. | 427 // used for enumerating audio output devices. |
| 434 // Note: Enumeration tasks may take seconds to complete so must never be run | 428 // Note: Enumeration tasks may take seconds to complete so must never be run |
| 435 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. | 429 // on any of the BrowserThreads (UI, IO, etc). See http://crbug.com/256945. |
| 436 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; | 430 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_; |
| 437 | 431 |
| 438 media::AudioManager* const audio_manager_; // not owned | 432 media::AudioManager* const audio_manager_; // not owned |
| 439 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 433 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
| 440 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 434 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
| 441 std::unique_ptr<AudioOutputDeviceEnumerator> audio_output_device_enumerator_; | |
| 442 #if defined(OS_WIN) | 435 #if defined(OS_WIN) |
| 443 base::Thread video_capture_thread_; | 436 base::Thread video_capture_thread_; |
| 444 #endif | 437 #endif |
| 445 | 438 |
| 446 std::unique_ptr<MediaDevicesManager> media_devices_manager_; | 439 std::unique_ptr<MediaDevicesManager> media_devices_manager_; |
| 447 | 440 |
| 448 // All non-closed request. Must be accessed on IO thread. | 441 // All non-closed request. Must be accessed on IO thread. |
| 449 DeviceRequests requests_; | 442 DeviceRequests requests_; |
| 450 | 443 |
| 451 bool use_fake_ui_; | 444 bool use_fake_ui_; |
| 452 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; | 445 std::unique_ptr<FakeMediaStreamUIProxy> fake_ui_; |
| 453 | 446 |
| 454 // Maps render process hosts to log callbacks. Used on the IO thread. | 447 // Maps render process hosts to log callbacks. Used on the IO thread. |
| 455 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; | 448 std::map<int, base::Callback<void(const std::string&)>> log_callbacks_; |
| 456 | 449 |
| 457 // Objects subscribed to changes in the set of media devices. | 450 // Objects subscribed to changes in the set of media devices. |
| 458 std::vector<MediaStreamRequester*> device_change_subscribers_; | 451 std::vector<MediaStreamRequester*> device_change_subscribers_; |
| 459 | 452 |
| 460 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 453 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
| 461 }; | 454 }; |
| 462 | 455 |
| 463 } // namespace content | 456 } // namespace content |
| 464 | 457 |
| 465 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 458 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
| OLD | NEW |