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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 // MediaStreamManager is used to generate and close new media devices, not to | 79 // MediaStreamManager is used to generate and close new media devices, not to |
80 // start the media flow. | 80 // start the media flow. |
81 // The classes requesting new media streams are answered using | 81 // The classes requesting new media streams are answered using |
82 // MediaStreamManager::Listener. | 82 // MediaStreamManager::Listener. |
83 class CONTENT_EXPORT MediaStreamManager | 83 class CONTENT_EXPORT MediaStreamManager |
84 : public MediaStreamProviderListener, | 84 : public MediaStreamProviderListener, |
85 public MessageLoop::DestructionObserver, | 85 public MessageLoop::DestructionObserver, |
86 public SettingsRequester, | 86 public SettingsRequester, |
87 public base::SystemMonitor::DevicesChangedObserver { | 87 public base::SystemMonitor::DevicesChangedObserver { |
88 public: | 88 public: |
89 // Contains all data needed to keep track of requests. | |
90 class DeviceRequest; | |
no longer working on chromium
2012/10/12 14:00:59
why expose it to public, can we keep it to private
justinlin
2012/10/12 20:04:20
Done. Can move it back now that the static is gone
| |
91 | |
89 explicit MediaStreamManager(media::AudioManager* audio_manager); | 92 explicit MediaStreamManager(media::AudioManager* audio_manager); |
90 virtual ~MediaStreamManager(); | 93 virtual ~MediaStreamManager(); |
91 | 94 |
92 // Used to access VideoCaptureManager. | 95 // Used to access VideoCaptureManager. |
93 VideoCaptureManager* video_capture_manager(); | 96 VideoCaptureManager* video_capture_manager(); |
94 | 97 |
95 // Used to access AudioInputDeviceManager. | 98 // Used to access AudioInputDeviceManager. |
96 AudioInputDeviceManager* audio_input_device_manager(); | 99 AudioInputDeviceManager* audio_input_device_manager(); |
97 | 100 |
98 // GenerateStream opens new media devices according to |components|. It | 101 // GenerateStream opens new media devices according to |components|. It |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 // Call to have all GenerateStream calls from now on use fake devices instead | 173 // Call to have all GenerateStream calls from now on use fake devices instead |
171 // of real ones. This should NOT be used in production versions of Chrome. | 174 // of real ones. This should NOT be used in production versions of Chrome. |
172 static void AlwaysUseFakeDevice(); | 175 static void AlwaysUseFakeDevice(); |
173 | 176 |
174 // This object gets deleted on the UI thread after the IO thread has been | 177 // This object gets deleted on the UI thread after the IO thread has been |
175 // destroyed. So we need to know when IO thread is being destroyed so that | 178 // destroyed. So we need to know when IO thread is being destroyed so that |
176 // we can delete VideoCaptureManager and AudioInputDeviceManager. | 179 // we can delete VideoCaptureManager and AudioInputDeviceManager. |
177 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 180 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
178 | 181 |
179 private: | 182 private: |
180 // Contains all data needed to keep track of requests. | |
181 struct DeviceRequest; | |
182 | |
183 // Cache enumerated device list. | 183 // Cache enumerated device list. |
184 struct EnumerationCache { | 184 struct EnumerationCache { |
185 EnumerationCache(); | 185 EnumerationCache(); |
186 ~EnumerationCache(); | 186 ~EnumerationCache(); |
187 | 187 |
188 bool valid; | 188 bool valid; |
189 StreamDeviceInfoArray devices; | 189 StreamDeviceInfoArray devices; |
190 }; | 190 }; |
191 | 191 |
192 // Helpers for signaling the media observer that new capture devices are | 192 // Helpers for signaling the media observer that new capture devices are |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 | 252 |
253 // Static members. | 253 // Static members. |
254 static bool always_use_fake_devices_; | 254 static bool always_use_fake_devices_; |
255 | 255 |
256 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 256 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
257 }; | 257 }; |
258 | 258 |
259 } // namespace media_stream | 259 } // namespace media_stream |
260 | 260 |
261 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 261 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |