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

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.h

Issue 11048029: Allow Thread to initialize COM for Windows consumers who need it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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/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 MediaStreamDeviceSettings for permission to 9 // 2. MediaStreamManager will ask MediaStreamDeviceSettings for permission to
10 // use devices and for which device to use. 10 // use devices and for which device to use.
(...skipping 12 matching lines...) Expand all
23 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 23 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
24 24
25 #include <map> 25 #include <map>
26 #include <string> 26 #include <string>
27 27
28 #include "base/basictypes.h" 28 #include "base/basictypes.h"
29 #include "base/memory/scoped_ptr.h" 29 #include "base/memory/scoped_ptr.h"
30 #include "base/memory/ref_counted.h" 30 #include "base/memory/ref_counted.h"
31 #include "base/message_loop.h" 31 #include "base/message_loop.h"
32 #include "base/system_monitor/system_monitor.h" 32 #include "base/system_monitor/system_monitor.h"
33 #include "base/threading/thread.h"
34 #include "content/browser/renderer_host/media/media_stream_provider.h" 33 #include "content/browser/renderer_host/media/media_stream_provider.h"
35 #include "content/browser/renderer_host/media/media_stream_settings_requester.h" 34 #include "content/browser/renderer_host/media/media_stream_settings_requester.h"
36 #include "content/common/media/media_stream_options.h" 35 #include "content/common/media/media_stream_options.h"
37 #include "content/common/content_export.h" 36 #include "content/common/content_export.h"
38 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
39 38
40 #if defined(OS_WIN)
41 namespace base { 39 namespace base {
42 namespace win { 40 class ComThread;
43 class ScopedCOMInitializer;
44 } 41 }
45 }
46 #endif
47 42
48 namespace media { 43 namespace media {
49 class AudioManager; 44 class AudioManager;
50 } 45 }
51 46
52 namespace media_stream { 47 namespace media_stream {
53 48
54 class AudioInputDeviceManager; 49 class AudioInputDeviceManager;
55 class MediaStreamDeviceSettings; 50 class MediaStreamDeviceSettings;
56 class MediaStreamRequester; 51 class MediaStreamRequester;
57 class VideoCaptureManager; 52 class VideoCaptureManager;
58 53
59 // Thread that enters MTA on Windows.
60 #if defined(OS_WIN)
61 class DeviceThread : public base::Thread {
62 public:
63 explicit DeviceThread(const char* name);
64 virtual ~DeviceThread();
65
66 protected:
67 virtual void Init() OVERRIDE;
68 virtual void CleanUp() OVERRIDE;
69
70 private:
71 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
72
73 DISALLOW_COPY_AND_ASSIGN(DeviceThread);
74 };
75 #else
76 typedef base::Thread DeviceThread;
77 #endif
78
79 // MediaStreamManager is used to generate and close new media devices, not to 54 // MediaStreamManager is used to generate and close new media devices, not to
80 // start the media flow. 55 // start the media flow.
81 // The classes requesting new media streams are answered using 56 // The classes requesting new media streams are answered using
82 // MediaStreamManager::Listener. 57 // MediaStreamManager::Listener.
83 class CONTENT_EXPORT MediaStreamManager 58 class CONTENT_EXPORT MediaStreamManager
84 : public MediaStreamProviderListener, 59 : public MediaStreamProviderListener,
85 public MessageLoop::DestructionObserver, 60 public MessageLoop::DestructionObserver,
86 public SettingsRequester, 61 public SettingsRequester,
87 public base::SystemMonitor::DevicesChangedObserver { 62 public base::SystemMonitor::DevicesChangedObserver {
88 public: 63 public:
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label); 190 void SendCachedDeviceList(EnumerationCache* cache, const std::string& label);
216 191
217 // Stop the request of enumerating devices indentified by |label|. 192 // Stop the request of enumerating devices indentified by |label|.
218 void StopEnumerateDevices(const std::string& label); 193 void StopEnumerateDevices(const std::string& label);
219 194
220 // Helpers to start and stop monitoring devices. 195 // Helpers to start and stop monitoring devices.
221 void StartMonitoring(); 196 void StartMonitoring();
222 void StopMonitoring(); 197 void StopMonitoring();
223 198
224 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager. 199 // Device thread shared by VideoCaptureManager and AudioInputDeviceManager.
225 scoped_ptr<DeviceThread> device_thread_; 200 scoped_ptr<base::ComThread> device_thread_;
226 201
227 scoped_ptr<MediaStreamDeviceSettings> device_settings_; 202 scoped_ptr<MediaStreamDeviceSettings> device_settings_;
228 203
229 media::AudioManager* const audio_manager_; // not owned 204 media::AudioManager* const audio_manager_; // not owned
230 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_; 205 scoped_refptr<AudioInputDeviceManager> audio_input_device_manager_;
231 scoped_refptr<VideoCaptureManager> video_capture_manager_; 206 scoped_refptr<VideoCaptureManager> video_capture_manager_;
232 207
233 // Indicator of device monitoring state. 208 // Indicator of device monitoring state.
234 bool monitoring_started_; 209 bool monitoring_started_;
235 210
(...skipping 16 matching lines...) Expand all
252 227
253 // Static members. 228 // Static members.
254 static bool always_use_fake_devices_; 229 static bool always_use_fake_devices_;
255 230
256 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); 231 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager);
257 }; 232 };
258 233
259 } // namespace media_stream 234 } // namespace media_stream
260 235
261 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ 236 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698