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 20 matching lines...) Expand all Loading... |
31 #include "base/memory/ref_counted.h" | 31 #include "base/memory/ref_counted.h" |
32 #include "base/memory/scoped_ptr.h" | 32 #include "base/memory/scoped_ptr.h" |
33 #include "base/message_loop/message_loop.h" | 33 #include "base/message_loop/message_loop.h" |
34 #include "base/power_monitor/power_observer.h" | 34 #include "base/power_monitor/power_observer.h" |
35 #include "base/system_monitor/system_monitor.h" | 35 #include "base/system_monitor/system_monitor.h" |
36 #include "content/browser/renderer_host/media/media_stream_provider.h" | 36 #include "content/browser/renderer_host/media/media_stream_provider.h" |
37 #include "content/common/content_export.h" | 37 #include "content/common/content_export.h" |
38 #include "content/common/media/media_stream_options.h" | 38 #include "content/common/media/media_stream_options.h" |
39 #include "content/public/browser/media_request_state.h" | 39 #include "content/public/browser/media_request_state.h" |
40 #include "content/public/browser/resource_context.h" | 40 #include "content/public/browser/resource_context.h" |
| 41 #include "media/video/capture/video_capture_device_factory.h" |
41 | 42 |
42 namespace media { | 43 namespace media { |
43 class AudioManager; | 44 class AudioManager; |
44 } | 45 } |
45 | 46 |
46 namespace content { | 47 namespace content { |
47 | 48 |
48 class AudioInputDeviceManager; | 49 class AudioInputDeviceManager; |
49 class FakeMediaStreamUIProxy; | 50 class FakeMediaStreamUIProxy; |
50 class MediaStreamDeviceSettings; | 51 class MediaStreamDeviceSettings; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 int capture_session_id) OVERRIDE; | 155 int capture_session_id) OVERRIDE; |
155 virtual void Closed(MediaStreamType stream_type, | 156 virtual void Closed(MediaStreamType stream_type, |
156 int capture_session_id) OVERRIDE; | 157 int capture_session_id) OVERRIDE; |
157 virtual void DevicesEnumerated(MediaStreamType stream_type, | 158 virtual void DevicesEnumerated(MediaStreamType stream_type, |
158 const StreamDeviceInfoArray& devices) OVERRIDE; | 159 const StreamDeviceInfoArray& devices) OVERRIDE; |
159 | 160 |
160 // Implements base::SystemMonitor::DevicesChangedObserver. | 161 // Implements base::SystemMonitor::DevicesChangedObserver. |
161 virtual void OnDevicesChanged( | 162 virtual void OnDevicesChanged( |
162 base::SystemMonitor::DeviceType device_type) OVERRIDE; | 163 base::SystemMonitor::DeviceType device_type) OVERRIDE; |
163 | 164 |
164 // Used by unit test to make sure fake devices are used instead of a real | 165 // Used by unit test to make sure that a fake video device or devices are used |
165 // devices, which is needed for server based testing or certain tests (which | 166 // instead of real ones, which is needed for server based testing or certain |
166 // can pass --use-fake-device-for-media-stream). | 167 // tests (which can pass --use-fake-device-for-media-stream). |
167 void UseFakeDevice(); | 168 void UseFakeVideoDevice(scoped_ptr<media::VideoCaptureDeviceFactory> factory); |
| 169 // Same as the previous for using a fake audio device or devices. |
| 170 void UseFakeAudioDevice(); |
168 | 171 |
169 // Called by the tests to specify a fake UI that should be used for next | 172 // Called by the tests to specify a fake UI that should be used for next |
170 // generated stream (or when using --use-fake-ui-for-media-stream). | 173 // generated stream (or when using --use-fake-ui-for-media-stream). |
171 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); | 174 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); |
172 | 175 |
173 // Returns all devices currently opened by a request with label |label|. | 176 // Returns all devices currently opened by a request with label |label|. |
174 // If no request with |label| exist, an empty array is returned. | 177 // If no request with |label| exist, an empty array is returned. |
175 StreamDeviceInfoArray GetDevicesOpenedByRequest( | 178 StreamDeviceInfoArray GetDevicesOpenedByRequest( |
176 const std::string& label) const; | 179 const std::string& label) const; |
177 | 180 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 384 |
382 bool use_fake_ui_; | 385 bool use_fake_ui_; |
383 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 386 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
384 | 387 |
385 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 388 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
386 }; | 389 }; |
387 | 390 |
388 } // namespace content | 391 } // namespace content |
389 | 392 |
390 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 393 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |