Chromium Code Reviews| Index: content/browser/renderer_host/media/media_stream_manager.h |
| diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h |
| index 17f863e90fda9b5140ee47983298bb4f17ac1026..97596eff6d19d93fa187d689e25cb905b601738b 100644 |
| --- a/content/browser/renderer_host/media/media_stream_manager.h |
| +++ b/content/browser/renderer_host/media/media_stream_manager.h |
| @@ -30,19 +30,21 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/supports_user_data.h" |
| +#include "base/threading/thread.h" |
| #include "content/browser/renderer_host/media/media_stream_provider.h" |
| #include "content/browser/renderer_host/media/media_stream_settings_requester.h" |
| #include "content/common/media/media_stream_options.h" |
| #include "content/common/content_export.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +#if defined(OS_WIN) |
| +#include <objbase.h> // For CoInitialize/CoUninitialize. |
| +#endif |
| namespace content { |
| class ResourceContext; |
| } |
| -namespace media { |
| -class AudioManager; |
| -} |
| - |
| namespace media_stream { |
| class AudioInputDeviceManager; |
| @@ -50,6 +52,26 @@ class MediaStreamDeviceSettings; |
| class MediaStreamRequester; |
| class VideoCaptureManager; |
| +// Thread that enters STA on windows, and is base::thread on linux and mac. |
| +class DeviceThread : public base::Thread { |
| + public: |
| + explicit DeviceThread(const char *name) : base::Thread(name) {} |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
const char* name
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| + |
| + protected: |
| +#if defined(OS_WIN) |
| + // Called just prior to starting the message loop. |
| + virtual void Init() { |
| + CoInitialize(NULL); |
|
tommi (sloooow) - chröme
2012/07/02 13:36:36
use the ScopedCOMInitializer class and remove the
no longer working on chromium
2012/07/04 12:35:25
Done.
|
| + } |
| + |
| + // Called just after the message loop ends. |
| + virtual void CleanUp() { |
| + CoUninitialize(); |
| + } |
| +#endif |
| + DISALLOW_COPY_AND_ASSIGN(DeviceThread); |
| +}; |
| + |
| // MediaStreamManager is used to generate and close new media devices, not to |
| // start the media flow. |
| // The classes requesting new media streams are answered using |
| @@ -62,10 +84,10 @@ class CONTENT_EXPORT MediaStreamManager |
| // Returns the MediaStreamManager for the given ResourceContext. If it hasn't |
| // been created yet, it will be constructed with the given AudioManager. |
| static MediaStreamManager* GetForResourceContext( |
| - content::ResourceContext* resource_context, |
| - media::AudioManager* audio_manager); |
| + content::ResourceContext* resource_context); |
| + |
| + MediaStreamManager(); |
| - explicit MediaStreamManager(media::AudioManager* audio_manager); |
| virtual ~MediaStreamManager(); |
| // Used to access VideoCaptureManager. |
| @@ -149,6 +171,12 @@ class CONTENT_EXPORT MediaStreamManager |
| void StartEnumeration(DeviceRequest* new_request, |
| std::string* label); |
| + // Helper to ensure the device thread before passing to device managers. |
| + void EnsureDeviceThread(); |
| + |
| + // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. |
| + scoped_ptr<base::Thread> device_thread_; |
| + |
| scoped_ptr<MediaStreamDeviceSettings> device_settings_; |
| scoped_refptr<VideoCaptureManager> video_capture_manager_; |
| scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; |
| @@ -160,7 +188,6 @@ class CONTENT_EXPORT MediaStreamManager |
| // All non-closed request. |
| typedef std::map<std::string, DeviceRequest> DeviceRequests; |
| DeviceRequests requests_; |
| - media::AudioManager* audio_manager_; |
| DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
| }; |