| 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 #include "content/browser/renderer_host/media/video_capture_manager.h" | 5 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 media::VideoCaptureSessionId capture_session_id, | 879 media::VideoCaptureSessionId capture_session_id, |
| 880 media::VideoCaptureFormats* supported_formats) { | 880 media::VideoCaptureFormats* supported_formats) { |
| 881 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 881 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 882 DCHECK(supported_formats->empty()); | 882 DCHECK(supported_formats->empty()); |
| 883 | 883 |
| 884 SessionMap::iterator it = sessions_.find(capture_session_id); | 884 SessionMap::iterator it = sessions_.find(capture_session_id); |
| 885 if (it == sessions_.end()) | 885 if (it == sessions_.end()) |
| 886 return false; | 886 return false; |
| 887 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; | 887 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; |
| 888 | 888 |
| 889 return GetDeviceSupportedFormats(it->second.id, supported_formats); |
| 890 } |
| 891 |
| 892 bool VideoCaptureManager::GetDeviceSupportedFormats( |
| 893 const std::string& device_id, |
| 894 media::VideoCaptureFormats* supported_formats) { |
| 895 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 896 DCHECK(supported_formats->empty()); |
| 897 |
| 889 // Return all available formats of the device, regardless its started state. | 898 // Return all available formats of the device, regardless its started state. |
| 890 DeviceInfo* existing_device = GetDeviceInfoById(it->second.id); | 899 DeviceInfo* existing_device = GetDeviceInfoById(device_id); |
| 891 if (existing_device) | 900 if (existing_device) |
| 892 *supported_formats = existing_device->supported_formats; | 901 *supported_formats = existing_device->supported_formats; |
| 893 return true; | 902 return true; |
| 894 } | 903 } |
| 895 | 904 |
| 896 bool VideoCaptureManager::GetDeviceFormatsInUse( | 905 bool VideoCaptureManager::GetDeviceFormatsInUse( |
| 897 media::VideoCaptureSessionId capture_session_id, | 906 media::VideoCaptureSessionId capture_session_id, |
| 898 media::VideoCaptureFormats* formats_in_use) { | 907 media::VideoCaptureFormats* formats_in_use) { |
| 899 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 908 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 900 DCHECK(formats_in_use->empty()); | 909 DCHECK(formats_in_use->empty()); |
| 901 | 910 |
| 902 SessionMap::iterator it = sessions_.find(capture_session_id); | 911 SessionMap::iterator it = sessions_.find(capture_session_id); |
| 903 if (it == sessions_.end()) | 912 if (it == sessions_.end()) |
| 904 return false; | 913 return false; |
| 905 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name; | 914 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name; |
| 906 | 915 |
| 916 return GetDeviceFormatsInUse(it->second.type, it->second.id, formats_in_use); |
| 917 } |
| 918 |
| 919 bool VideoCaptureManager::GetDeviceFormatsInUse( |
| 920 MediaStreamType stream_type, |
| 921 const std::string& device_id, |
| 922 media::VideoCaptureFormats* formats_in_use) { |
| 923 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 924 DCHECK(formats_in_use->empty()); |
| 907 // Return the currently in-use format(s) of the device, if it's started. | 925 // Return the currently in-use format(s) of the device, if it's started. |
| 908 DeviceEntry* device_in_use = | 926 DeviceEntry* device_in_use = |
| 909 GetDeviceEntryByTypeAndId(it->second.type, it->second.id); | 927 GetDeviceEntryByTypeAndId(stream_type, device_id); |
| 910 if (device_in_use) { | 928 if (device_in_use) { |
| 911 // Currently only one format-in-use is supported at the VCC level. | 929 // Currently only one format-in-use is supported at the VCC level. |
| 912 formats_in_use->push_back( | 930 formats_in_use->push_back( |
| 913 device_in_use->video_capture_controller.GetVideoCaptureFormat()); | 931 device_in_use->video_capture_controller.GetVideoCaptureFormat()); |
| 914 } | 932 } |
| 915 return true; | 933 return true; |
| 916 } | 934 } |
| 917 | 935 |
| 918 void VideoCaptureManager::SetDesktopCaptureWindowId( | 936 void VideoCaptureManager::SetDesktopCaptureWindowId( |
| 919 media::VideoCaptureSessionId session_id, | 937 media::VideoCaptureSessionId session_id, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 if (!device_in_queue) { | 1339 if (!device_in_queue) { |
| 1322 // Session ID is only valid for Screen capture. So we can fake it to | 1340 // Session ID is only valid for Screen capture. So we can fake it to |
| 1323 // resume video capture devices here. | 1341 // resume video capture devices here. |
| 1324 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); | 1342 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); |
| 1325 } | 1343 } |
| 1326 } | 1344 } |
| 1327 } | 1345 } |
| 1328 #endif // defined(OS_ANDROID) | 1346 #endif // defined(OS_ANDROID) |
| 1329 | 1347 |
| 1330 } // namespace content | 1348 } // namespace content |
| OLD | NEW |