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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Initializes the device managers on IO thread. Auto-starts the device | 214 // Initializes the device managers on IO thread. Auto-starts the device |
215 // thread and registers this as a listener with the device managers. | 215 // thread and registers this as a listener with the device managers. |
216 void InitializeDeviceManagersOnIOThread(); | 216 void InitializeDeviceManagersOnIOThread(); |
217 | 217 |
218 // Helper for sending up-to-date device lists to media observer when a | 218 // Helper for sending up-to-date device lists to media observer when a |
219 // capture device is plugged in or unplugged. | 219 // capture device is plugged in or unplugged. |
220 void NotifyDevicesChanged(MediaStreamType stream_type, | 220 void NotifyDevicesChanged(MediaStreamType stream_type, |
221 const StreamDeviceInfoArray& devices); | 221 const StreamDeviceInfoArray& devices); |
222 | 222 |
223 void HandleAccessRequestResponse(const std::string& label, | 223 void HandleAccessRequestResponse(const std::string& label, |
224 const MediaStreamDevices& devices); | 224 const MediaStreamDevices& devices, |
| 225 content::MediaStreamRequestResult result); |
225 void StopMediaStreamFromBrowser(const std::string& label); | 226 void StopMediaStreamFromBrowser(const std::string& label); |
226 | 227 |
227 void DoEnumerateDevices(const std::string& label); | 228 void DoEnumerateDevices(const std::string& label); |
228 | 229 |
229 // Helpers. | 230 // Helpers. |
230 // Checks if all devices that was requested in the request identififed by | 231 // Checks if all devices that was requested in the request identififed by |
231 // |label| has been opened and set the request state accordingly. | 232 // |label| has been opened and set the request state accordingly. |
232 void HandleRequestDone(const std::string& label, | 233 void HandleRequestDone(const std::string& label, |
233 DeviceRequest* request); | 234 DeviceRequest* request); |
234 // Stop the use of the device associated with |session_id| of type |type| in | 235 // Stop the use of the device associated with |session_id| of type |type| in |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // about the device. | 278 // about the device. |
278 bool FindExistingRequestedDeviceInfo( | 279 bool FindExistingRequestedDeviceInfo( |
279 const DeviceRequest& new_request, | 280 const DeviceRequest& new_request, |
280 const MediaStreamDevice& new_device_info, | 281 const MediaStreamDevice& new_device_info, |
281 StreamDeviceInfo* existing_device_info, | 282 StreamDeviceInfo* existing_device_info, |
282 MediaRequestState* existing_request_state) const; | 283 MediaRequestState* existing_request_state) const; |
283 | 284 |
284 void FinalizeGenerateStream(const std::string& label, | 285 void FinalizeGenerateStream(const std::string& label, |
285 DeviceRequest* request); | 286 DeviceRequest* request); |
286 void FinalizeRequestFailed(const std::string& label, | 287 void FinalizeRequestFailed(const std::string& label, |
287 DeviceRequest* request); | 288 DeviceRequest* request, |
| 289 content::MediaStreamRequestResult result); |
288 void FinalizeOpenDevice(const std::string& label, | 290 void FinalizeOpenDevice(const std::string& label, |
289 DeviceRequest* request); | 291 DeviceRequest* request); |
290 void FinalizeMediaAccessRequest(const std::string& label, | 292 void FinalizeMediaAccessRequest(const std::string& label, |
291 DeviceRequest* request, | 293 DeviceRequest* request, |
292 const MediaStreamDevices& devices); | 294 const MediaStreamDevices& devices); |
293 void FinalizeEnumerateDevices(const std::string& label, | 295 void FinalizeEnumerateDevices(const std::string& label, |
294 DeviceRequest* request); | 296 DeviceRequest* request); |
295 | 297 |
296 // This method is called when an audio or video device is plugged in or | 298 // This method is called when an audio or video device is plugged in or |
297 // removed. It make sure all MediaStreams that use a removed device is | 299 // removed. It make sure all MediaStreams that use a removed device is |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 368 |
367 bool use_fake_ui_; | 369 bool use_fake_ui_; |
368 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 370 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
369 | 371 |
370 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 372 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
371 }; | 373 }; |
372 | 374 |
373 } // namespace content | 375 } // namespace content |
374 | 376 |
375 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 377 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |