Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager.cc

Issue 2646833002: Add IPC to query capabilities of video input devices. (Closed)
Patch Set: address comment from clamy Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 media::VideoCaptureSessionId capture_session_id, 882 media::VideoCaptureSessionId capture_session_id,
883 media::VideoCaptureFormats* supported_formats) { 883 media::VideoCaptureFormats* supported_formats) {
884 DCHECK_CURRENTLY_ON(BrowserThread::IO); 884 DCHECK_CURRENTLY_ON(BrowserThread::IO);
885 DCHECK(supported_formats->empty()); 885 DCHECK(supported_formats->empty());
886 886
887 SessionMap::iterator it = sessions_.find(capture_session_id); 887 SessionMap::iterator it = sessions_.find(capture_session_id);
888 if (it == sessions_.end()) 888 if (it == sessions_.end())
889 return false; 889 return false;
890 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name; 890 DVLOG(1) << "GetDeviceSupportedFormats for device: " << it->second.name;
891 891
892 return GetDeviceSupportedFormats(it->second.id, supported_formats);
893 }
894
895 bool VideoCaptureManager::GetDeviceSupportedFormats(
896 const std::string& device_id,
897 media::VideoCaptureFormats* supported_formats) {
898 DCHECK_CURRENTLY_ON(BrowserThread::IO);
899 DCHECK(supported_formats->empty());
900
892 // Return all available formats of the device, regardless its started state. 901 // Return all available formats of the device, regardless its started state.
893 DeviceInfo* existing_device = GetDeviceInfoById(it->second.id); 902 DeviceInfo* existing_device = GetDeviceInfoById(device_id);
894 if (existing_device) 903 if (existing_device)
895 *supported_formats = existing_device->supported_formats; 904 *supported_formats = existing_device->supported_formats;
896 return true; 905 return true;
897 } 906 }
898 907
899 bool VideoCaptureManager::GetDeviceFormatsInUse( 908 bool VideoCaptureManager::GetDeviceFormatsInUse(
900 media::VideoCaptureSessionId capture_session_id, 909 media::VideoCaptureSessionId capture_session_id,
901 media::VideoCaptureFormats* formats_in_use) { 910 media::VideoCaptureFormats* formats_in_use) {
902 DCHECK_CURRENTLY_ON(BrowserThread::IO); 911 DCHECK_CURRENTLY_ON(BrowserThread::IO);
903 DCHECK(formats_in_use->empty()); 912 DCHECK(formats_in_use->empty());
904 913
905 SessionMap::iterator it = sessions_.find(capture_session_id); 914 SessionMap::iterator it = sessions_.find(capture_session_id);
906 if (it == sessions_.end()) 915 if (it == sessions_.end())
907 return false; 916 return false;
908 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name; 917 DVLOG(1) << "GetDeviceFormatsInUse for device: " << it->second.name;
909 918
919 return GetDeviceFormatsInUse(it->second.type, it->second.id, formats_in_use);
920 }
921
922 bool VideoCaptureManager::GetDeviceFormatsInUse(
923 MediaStreamType stream_type,
924 const std::string& device_id,
925 media::VideoCaptureFormats* formats_in_use) {
926 DCHECK_CURRENTLY_ON(BrowserThread::IO);
927 DCHECK(formats_in_use->empty());
910 // Return the currently in-use format(s) of the device, if it's started. 928 // Return the currently in-use format(s) of the device, if it's started.
911 DeviceEntry* device_in_use = 929 DeviceEntry* device_in_use =
912 GetDeviceEntryByTypeAndId(it->second.type, it->second.id); 930 GetDeviceEntryByTypeAndId(stream_type, device_id);
913 if (device_in_use) { 931 if (device_in_use) {
914 // Currently only one format-in-use is supported at the VCC level. 932 // Currently only one format-in-use is supported at the VCC level.
915 formats_in_use->push_back( 933 formats_in_use->push_back(
916 device_in_use->video_capture_controller.GetVideoCaptureFormat()); 934 device_in_use->video_capture_controller.GetVideoCaptureFormat());
917 } 935 }
918 return true; 936 return true;
919 } 937 }
920 938
921 void VideoCaptureManager::SetDesktopCaptureWindowId( 939 void VideoCaptureManager::SetDesktopCaptureWindowId(
922 media::VideoCaptureSessionId session_id, 940 media::VideoCaptureSessionId session_id,
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 if (!device_in_queue) { 1342 if (!device_in_queue) {
1325 // Session ID is only valid for Screen capture. So we can fake it to 1343 // Session ID is only valid for Screen capture. So we can fake it to
1326 // resume video capture devices here. 1344 // resume video capture devices here.
1327 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters); 1345 QueueStartDevice(kFakeSessionId, entry.get(), entry->parameters);
1328 } 1346 }
1329 } 1347 }
1330 } 1348 }
1331 #endif // defined(OS_ANDROID) 1349 #endif // defined(OS_ANDROID)
1332 1350
1333 } // namespace content 1351 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698