Index: media/capture/video/mac/video_capture_device_factory_mac.mm |
diff --git a/media/capture/video/mac/video_capture_device_factory_mac.mm b/media/capture/video/mac/video_capture_device_factory_mac.mm |
index 5d92f7eb12c9b2c6d0d5616090d8e97d54ab9ea7..682cc07beccde996d38502c2f06ecf3d413c6b3e 100644 |
--- a/media/capture/video/mac/video_capture_device_factory_mac.mm |
+++ b/media/capture/video/mac/video_capture_device_factory_mac.mm |
@@ -19,15 +19,11 @@ |
#import "media/capture/video/mac/video_capture_device_avfoundation_mac.h" |
#import "media/capture/video/mac/video_capture_device_decklink_mac.h" |
#include "media/capture/video/mac/video_capture_device_mac.h" |
-#import "media/capture/video/mac/video_capture_device_qtkit_mac.h" |
namespace media { |
-// In QTKit API, some devices are known to crash if VGA is requested, for them |
-// HD is the only supported resolution (see http://crbug.com/396812). In the |
-// AVfoundation case, we skip enumerating them altogether. These devices are |
-// identified by a characteristic trailing substring of uniqueId. At the moment |
-// these are just Blackmagic devices. |
+// Blacklisted devices are identified by a characteristic trailing substring of |
+// uniqueId. At the moment these are just Blackmagic devices. |
const struct NameAndVid { |
const char* unique_id_signature; |
const int capture_width; |
@@ -49,45 +45,7 @@ static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) { |
return is_device_blacklisted; |
} |
-static scoped_ptr<media::VideoCaptureDevice::Names> |
-EnumerateDevicesUsingQTKit() { |
- // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is |
- // fixed. |
- tracked_objects::ScopedTracker tracking_profile( |
- FROM_HERE_WITH_EXPLICIT_FUNCTION( |
- "458397 media::EnumerateDevicesUsingQTKit")); |
- |
- scoped_ptr<VideoCaptureDevice::Names> device_names( |
- new VideoCaptureDevice::Names()); |
- NSMutableDictionary* capture_devices = |
- [[[NSMutableDictionary alloc] init] autorelease]; |
- [VideoCaptureDeviceQTKit getDeviceNames:capture_devices]; |
- for (NSString* key in capture_devices) { |
- VideoCaptureDevice::Name name( |
- [[[capture_devices valueForKey:key] deviceName] UTF8String], |
- [key UTF8String], VideoCaptureDevice::Name::QTKIT); |
- if (IsDeviceBlacklisted(name)) |
- name.set_is_blacklisted(true); |
- device_names->push_back(name); |
- } |
- return device_names; |
-} |
- |
-static void RunDevicesEnumeratedCallback( |
- const base::Callback<void(scoped_ptr<media::VideoCaptureDevice::Names>)>& |
- callback, |
- scoped_ptr<media::VideoCaptureDevice::Names> device_names) { |
- // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/458397 is |
- // fixed. |
- tracked_objects::ScopedTracker tracking_profile( |
- FROM_HERE_WITH_EXPLICIT_FUNCTION( |
- "458397 media::RunDevicesEnumeratedCallback")); |
- callback.Run(std::move(device_names)); |
-} |
- |
-VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac( |
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) |
- : ui_task_runner_(ui_task_runner) { |
+VideoCaptureDeviceFactoryMac::VideoCaptureDeviceFactoryMac() { |
thread_checker_.DetachFromThread(); |
} |
@@ -124,50 +82,37 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames( |
DCHECK(thread_checker_.CalledOnValidThread()); |
// Loop through all available devices and add to |device_names|. |
NSDictionary* capture_devices; |
- if (AVFoundationGlue::IsAVFoundationSupported()) { |
- DVLOG(1) << "Enumerating video capture devices using AVFoundation"; |
- capture_devices = [VideoCaptureDeviceAVFoundation deviceNames]; |
- // Enumerate all devices found by AVFoundation, translate the info for each |
- // to class Name and add it to |device_names|. |
- for (NSString* key in capture_devices) { |
- int transport_type = [[capture_devices valueForKey:key] transportType]; |
- // Transport types are defined for Audio devices and reused for video. |
- VideoCaptureDevice::Name::TransportType device_transport_type = |
- (transport_type == kIOAudioDeviceTransportTypeBuiltIn || |
- transport_type == kIOAudioDeviceTransportTypeUSB) |
- ? VideoCaptureDevice::Name::USB_OR_BUILT_IN |
- : VideoCaptureDevice::Name::OTHER_TRANSPORT; |
- VideoCaptureDevice::Name name( |
- [[[capture_devices valueForKey:key] deviceName] UTF8String], |
- [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION, |
- device_transport_type); |
- if (IsDeviceBlacklisted(name)) |
- continue; |
- device_names->push_back(name); |
- } |
- // Also retrieve Blackmagic devices, if present, via DeckLink SDK API. |
- VideoCaptureDeviceDeckLinkMac::EnumerateDevices(device_names); |
- } else { |
- // We should not enumerate QTKit devices in Device Thread; |
- NOTREACHED(); |
+ DVLOG(1) << "Enumerating video capture devices using AVFoundation"; |
+ capture_devices = [VideoCaptureDeviceAVFoundation deviceNames]; |
+ // Enumerate all devices found by AVFoundation, translate the info for each |
+ // to class Name and add it to |device_names|. |
+ for (NSString* key in capture_devices) { |
+ int transport_type = [[capture_devices valueForKey:key] transportType]; |
+ // Transport types are defined for Audio devices and reused for video. |
+ VideoCaptureDevice::Name::TransportType device_transport_type = |
+ (transport_type == kIOAudioDeviceTransportTypeBuiltIn || |
+ transport_type == kIOAudioDeviceTransportTypeUSB) |
+ ? VideoCaptureDevice::Name::USB_OR_BUILT_IN |
+ : VideoCaptureDevice::Name::OTHER_TRANSPORT; |
+ VideoCaptureDevice::Name name( |
+ [[[capture_devices valueForKey:key] deviceName] UTF8String], |
+ [key UTF8String], VideoCaptureDevice::Name::AVFOUNDATION, |
+ device_transport_type); |
+ if (IsDeviceBlacklisted(name)) |
+ continue; |
+ device_names->push_back(name); |
} |
+ // Also retrieve Blackmagic devices, if present, via DeckLink SDK API. |
+ VideoCaptureDeviceDeckLinkMac::EnumerateDevices(device_names); |
} |
void VideoCaptureDeviceFactoryMac::EnumerateDeviceNames(const base::Callback< |
void(scoped_ptr<media::VideoCaptureDevice::Names>)>& callback) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- if (AVFoundationGlue::IsAVFoundationSupported()) { |
- scoped_ptr<VideoCaptureDevice::Names> device_names( |
- new VideoCaptureDevice::Names()); |
- GetDeviceNames(device_names.get()); |
- callback.Run(std::move(device_names)); |
- } else { |
- DVLOG(1) << "Enumerating video capture devices using QTKit"; |
- base::PostTaskAndReplyWithResult( |
- ui_task_runner_.get(), FROM_HERE, |
- base::Bind(&EnumerateDevicesUsingQTKit), |
- base::Bind(&RunDevicesEnumeratedCallback, callback)); |
- } |
+ scoped_ptr<VideoCaptureDevice::Names> device_names( |
+ new VideoCaptureDevice::Names()); |
+ GetDeviceNames(device_names.get()); |
+ callback.Run(std::move(device_names)); |
} |
void VideoCaptureDeviceFactoryMac::GetDeviceSupportedFormats( |
@@ -180,24 +125,6 @@ void VideoCaptureDeviceFactoryMac::GetDeviceSupportedFormats( |
[VideoCaptureDeviceAVFoundation getDevice:device |
supportedFormats:supported_formats]; |
break; |
- case VideoCaptureDevice::Name::QTKIT: |
- // Blacklisted cameras provide their own supported format(s), otherwise no |
- // such information is provided for QTKit devices. |
- if (device.is_blacklisted()) { |
- for (size_t i = 0; i < arraysize(kBlacklistedCameras); ++i) { |
- if (base::EndsWith(device.id(), |
- kBlacklistedCameras[i].unique_id_signature, |
- base::CompareCase::INSENSITIVE_ASCII)) { |
- supported_formats->push_back(media::VideoCaptureFormat( |
- gfx::Size(kBlacklistedCameras[i].capture_width, |
- kBlacklistedCameras[i].capture_height), |
- kBlacklistedCameras[i].capture_frame_rate, |
- media::PIXEL_FORMAT_UYVY)); |
- break; |
- } |
- } |
- } |
- break; |
case VideoCaptureDevice::Name::DECKLINK: |
DVLOG(1) << "Enumerating video capture capabilities " << device.name(); |
VideoCaptureDeviceDeckLinkMac::EnumerateDeviceCapabilities( |
@@ -212,7 +139,7 @@ void VideoCaptureDeviceFactoryMac::GetDeviceSupportedFormats( |
VideoCaptureDeviceFactory* |
VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
- return new VideoCaptureDeviceFactoryMac(ui_task_runner); |
+ return new VideoCaptureDeviceFactoryMac(); |
} |
} // namespace media |