| 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 13 matching lines...) Expand all Loading... |
| 24 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 24 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
| 25 | 25 |
| 26 #include <map> | 26 #include <map> |
| 27 #include <string> | 27 #include <string> |
| 28 | 28 |
| 29 #include "base/basictypes.h" | 29 #include "base/basictypes.h" |
| 30 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
| 31 #include "base/memory/ref_counted.h" | 31 #include "base/memory/ref_counted.h" |
| 32 #include "base/message_loop.h" | 32 #include "base/message_loop.h" |
| 33 #include "base/system_monitor/system_monitor.h" | 33 #include "base/system_monitor/system_monitor.h" |
| 34 #include "base/threading/thread.h" | |
| 35 #include "content/browser/renderer_host/media/media_stream_provider.h" | 34 #include "content/browser/renderer_host/media/media_stream_provider.h" |
| 36 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" | 35 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" |
| 37 #include "content/common/media/media_stream_options.h" | 36 #include "content/common/media/media_stream_options.h" |
| 38 #include "content/common/content_export.h" | 37 #include "content/common/content_export.h" |
| 39 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 40 | 39 |
| 41 #if defined(OS_WIN) | |
| 42 namespace base { | 40 namespace base { |
| 43 namespace win { | 41 class Thread; |
| 44 class ScopedCOMInitializer; | |
| 45 } | 42 } |
| 46 } | |
| 47 #endif | |
| 48 | 43 |
| 49 namespace content { | 44 namespace content { |
| 50 class MediaStreamUIController; | 45 class MediaStreamUIController; |
| 51 } | 46 } |
| 52 | 47 |
| 53 namespace media { | 48 namespace media { |
| 54 class AudioManager; | 49 class AudioManager; |
| 55 } | 50 } |
| 56 | 51 |
| 57 namespace media_stream { | 52 namespace media_stream { |
| 58 | 53 |
| 59 class AudioInputDeviceManager; | 54 class AudioInputDeviceManager; |
| 60 class MediaStreamDeviceSettings; | 55 class MediaStreamDeviceSettings; |
| 61 class MediaStreamRequester; | 56 class MediaStreamRequester; |
| 62 class VideoCaptureManager; | 57 class VideoCaptureManager; |
| 63 | 58 |
| 64 // Thread that enters MTA on Windows. | |
| 65 #if defined(OS_WIN) | |
| 66 class DeviceThread : public base::Thread { | |
| 67 public: | |
| 68 explicit DeviceThread(const char* name); | |
| 69 virtual ~DeviceThread(); | |
| 70 | |
| 71 protected: | |
| 72 virtual void Init() OVERRIDE; | |
| 73 virtual void CleanUp() OVERRIDE; | |
| 74 | |
| 75 private: | |
| 76 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(DeviceThread); | |
| 79 }; | |
| 80 #else | |
| 81 typedef base::Thread DeviceThread; | |
| 82 #endif | |
| 83 | |
| 84 // MediaStreamManager is used to generate and close new media devices, not to | 59 // MediaStreamManager is used to generate and close new media devices, not to |
| 85 // start the media flow. | 60 // start the media flow. |
| 86 // The classes requesting new media streams are answered using | 61 // The classes requesting new media streams are answered using |
| 87 // MediaStreamManager::Listener. | 62 // MediaStreamManager::Listener. |
| 88 class CONTENT_EXPORT MediaStreamManager | 63 class CONTENT_EXPORT MediaStreamManager |
| 89 : public MediaStreamProviderListener, | 64 : public MediaStreamProviderListener, |
| 90 public MessageLoop::DestructionObserver, | 65 public MessageLoop::DestructionObserver, |
| 91 public SettingsRequester, | 66 public SettingsRequester, |
| 92 public base::SystemMonitor::DevicesChangedObserver { | 67 public base::SystemMonitor::DevicesChangedObserver { |
| 93 public: | 68 public: |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label); | 221 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label); |
| 247 | 222 |
| 248 // Stop the request of enumerating devices indentified by |label|. | 223 // Stop the request of enumerating devices indentified by |label|. |
| 249 void StopEnumerateDevices(const std::string& label); | 224 void StopEnumerateDevices(const std::string& label); |
| 250 | 225 |
| 251 // Helpers to start and stop monitoring devices. | 226 // Helpers to start and stop monitoring devices. |
| 252 void StartMonitoring(); | 227 void StartMonitoring(); |
| 253 void StopMonitoring(); | 228 void StopMonitoring(); |
| 254 | 229 |
| 255 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. | 230 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. |
| 256 scoped_ptr<DeviceThread> device_thread_; | 231 scoped_ptr<base::Thread> device_thread_; |
| 257 | 232 |
| 258 scoped_ptr<content::MediaStreamUIController> ui_controller_; | 233 scoped_ptr<content::MediaStreamUIController> ui_controller_; |
| 259 | 234 |
| 260 media::AudioManager* const audio_manager_; // not owned | 235 media::AudioManager* const audio_manager_; // not owned |
| 261 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; | 236 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
| 262 scoped_refptr<VideoCaptureManager> video_capture_manager_; | 237 scoped_refptr<VideoCaptureManager> video_capture_manager_; |
| 263 | 238 |
| 264 // Indicator of device monitoring state. | 239 // Indicator of device monitoring state. |
| 265 bool monitoring_started_; | 240 bool monitoring_started_; |
| 266 | 241 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 283 | 258 |
| 284 // Static members. | 259 // Static members. |
| 285 static bool always_use_fake_devices_; | 260 static bool always_use_fake_devices_; |
| 286 | 261 |
| 287 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 262 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
| 288 }; | 263 }; |
| 289 | 264 |
| 290 } // namespace media_stream | 265 } // namespace media_stream |
| 291 | 266 |
| 292 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 267 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
| OLD | NEW |