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 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" | 5 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" |
6 | 6 |
7 #import <QTKit/QTKit.h> | 7 #import <QTKit/QTKit.h> |
8 | 8 |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 // Third-party drivers often throw exceptions, which are fatal in | 22 // Third-party drivers often throw exceptions, which are fatal in |
23 // Chromium (see comments in scoped_nsexception_enabler.h). The | 23 // Chromium (see comments in scoped_nsexception_enabler.h). The |
24 // following catches any exceptions and continues in an orderly | 24 // following catches any exceptions and continues in an orderly |
25 // fashion with no devices detected. | 25 // fashion with no devices detected. |
26 NSArray* captureDevices = | 26 NSArray* captureDevices = |
27 base::mac::RunBlockIgnoringExceptions(^{ | 27 base::mac::RunBlockIgnoringExceptions(^{ |
28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; | 28 return [QTCaptureDevice inputDevicesWithMediaType:QTMediaTypeVideo]; |
29 }); | 29 }); |
30 | 30 |
31 for (QTCaptureDevice* device in captureDevices) { | 31 for (QTCaptureDevice* device in captureDevices) { |
32 if (![[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue]) | 32 if ([[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue]) |
33 [deviceNames setObject:[device localizedDisplayName] | 33 continue; |
34 forKey:[device uniqueID]]; | 34 DeviceNameAndTransportType* name_and_transport_type = |
Robert Sesek
2014/07/01 16:23:57
nit: naming again
mcasas
2014/07/02 07:37:35
Done.
| |
35 [[[DeviceNameAndTransportType alloc] | |
36 initWithName:[device localizedDisplayName] | |
37 transportType:media::kIOAudioDeviceTransportTypeUnknown] | |
38 autorelease]; | |
39 [deviceNames setObject:name_and_transport_type | |
40 forKey:[device uniqueID]]; | |
35 } | 41 } |
36 } | 42 } |
37 | 43 |
38 + (NSDictionary*)deviceNames { | 44 + (NSDictionary*)deviceNames { |
39 NSMutableDictionary* deviceNames = | 45 NSMutableDictionary* deviceNames = |
40 [[[NSMutableDictionary alloc] init] autorelease]; | 46 [[[NSMutableDictionary alloc] init] autorelease]; |
41 | 47 |
42 // TODO(shess): Post to the main thread to see if that helps | 48 // TODO(shess): Post to the main thread to see if that helps |
43 // http://crbug.com/139164 | 49 // http://crbug.com/139164 |
44 [self performSelectorOnMainThread:@selector(getDeviceNames:) | 50 [self performSelectorOnMainThread:@selector(getDeviceNames:) |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 | 337 |
332 - (void)sendErrorString:(NSString*)error { | 338 - (void)sendErrorString:(NSString*)error { |
333 DLOG(ERROR) << [error UTF8String]; | 339 DLOG(ERROR) << [error UTF8String]; |
334 [lock_ lock]; | 340 [lock_ lock]; |
335 if (frameReceiver_) | 341 if (frameReceiver_) |
336 frameReceiver_->ReceiveError([error UTF8String]); | 342 frameReceiver_->ReceiveError([error UTF8String]); |
337 [lock_ unlock]; | 343 [lock_ unlock]; |
338 } | 344 } |
339 | 345 |
340 @end | 346 @end |
OLD | NEW |