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. |
11 // 3. MediaStreamManager will request the corresponding media device manager(s) | 11 // 3. MediaStreamManager will request the corresponding media device manager(s) |
12 // to enumerate available devices. The result will be given to | 12 // to enumerate available devices. The result will be given to |
13 // MediaStreamUIController. | 13 // MediaStreamUIController. |
14 // 4. MediaStreamUIController will, by posting the request to UI, let the | 14 // 4. MediaStreamUIController will, by posting the request to UI, let the |
15 // users to select which devices to use and send callback to | 15 // users to select which devices to use and send callback to |
16 // MediaStreamManager with the result. | 16 // MediaStreamManager with the result. |
17 // 5. MediaStreamManager will call the proper media device manager to open the | 17 // 5. MediaStreamManager will call the proper media device manager to open the |
18 // device and let the MediaStreamRequester know it has been done. | 18 // device and let the MediaStreamRequester know it has been done. |
19 | 19 |
| 20 // If either user or test harness selects --use-fake-device-for-media-stream, |
| 21 // a fake video device or devices are used instead of real ones. |
| 22 |
20 // When enumeration and open are done in separate operations, | 23 // When enumeration and open are done in separate operations, |
21 // MediaStreamUIController is not involved as in steps. | 24 // MediaStreamUIController is not involved as in steps. |
22 | 25 |
23 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 26 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
24 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 27 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
25 | 28 |
26 #include <map> | 29 #include <map> |
27 #include <set> | 30 #include <set> |
28 #include <string> | 31 #include <string> |
29 | 32 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 int capture_session_id) OVERRIDE; | 157 int capture_session_id) OVERRIDE; |
155 virtual void Closed(MediaStreamType stream_type, | 158 virtual void Closed(MediaStreamType stream_type, |
156 int capture_session_id) OVERRIDE; | 159 int capture_session_id) OVERRIDE; |
157 virtual void DevicesEnumerated(MediaStreamType stream_type, | 160 virtual void DevicesEnumerated(MediaStreamType stream_type, |
158 const StreamDeviceInfoArray& devices) OVERRIDE; | 161 const StreamDeviceInfoArray& devices) OVERRIDE; |
159 | 162 |
160 // Implements base::SystemMonitor::DevicesChangedObserver. | 163 // Implements base::SystemMonitor::DevicesChangedObserver. |
161 virtual void OnDevicesChanged( | 164 virtual void OnDevicesChanged( |
162 base::SystemMonitor::DeviceType device_type) OVERRIDE; | 165 base::SystemMonitor::DeviceType device_type) OVERRIDE; |
163 | 166 |
164 // Used by unit test to make sure fake devices are used instead of a real | |
165 // devices, which is needed for server based testing or certain tests (which | |
166 // can pass --use-fake-device-for-media-stream). | |
167 void UseFakeDevice(); | |
168 | |
169 // Called by the tests to specify a fake UI that should be used for next | 167 // 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). | 168 // generated stream (or when using --use-fake-ui-for-media-stream). |
171 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); | 169 void UseFakeUI(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); |
172 | 170 |
173 // Returns all devices currently opened by a request with label |label|. | 171 // Returns all devices currently opened by a request with label |label|. |
174 // If no request with |label| exist, an empty array is returned. | 172 // If no request with |label| exist, an empty array is returned. |
175 StreamDeviceInfoArray GetDevicesOpenedByRequest( | 173 StreamDeviceInfoArray GetDevicesOpenedByRequest( |
176 const std::string& label) const; | 174 const std::string& label) const; |
177 | 175 |
178 // This object gets deleted on the UI thread after the IO thread has been | 176 // This object gets deleted on the UI thread after the IO thread has been |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 379 |
382 bool use_fake_ui_; | 380 bool use_fake_ui_; |
383 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 381 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
384 | 382 |
385 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 383 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
386 }; | 384 }; |
387 | 385 |
388 } // namespace content | 386 } // namespace content |
389 | 387 |
390 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 388 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |