summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorbemasc@chromium.org <bemasc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 22:33:15 +0000
committerbemasc@chromium.org <bemasc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 22:33:15 +0000
commitc47c975a1d8773c501ca4b0cc938c5f2f9d28032 (patch)
tree90d301d587f2b0977bfdaae7ea642b993a579d3e /media
parent746b44a0922445c15cd41ea95867be654317a313 (diff)
downloadchromium_src-c47c975a1d8773c501ca4b0cc938c5f2f9d28032.zip
chromium_src-c47c975a1d8773c501ca4b0cc938c5f2f9d28032.tar.gz
chromium_src-c47c975a1d8773c501ca4b0cc938c5f2f9d28032.tar.bz2
Treat suspended video capture devices on Mac as unavailable.
This change 1. removes suspended cameras from the list of device names, 2. refuses to open suspended cameras, and 3. listens for suspend notifications to re-enumerate devices, and 4. fixes a logic error in QTMonitorImpl (initial count was always zero). With this change, the internal camera on Mac OS will disappear from the device list when the lid is closed, and reappear when the lid is opened. BUG=https://code.google.com/p/webrtc/issues/detail?id=1109 Review URL: https://codereview.chromium.org/55183002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/video/capture/mac/video_capture_device_qtkit_mac.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.mm b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
index e625d13..aa8ae4e 100644
--- a/media/video/capture/mac/video_capture_device_qtkit_mac.mm
+++ b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
@@ -28,8 +28,9 @@
});
for (QTCaptureDevice* device in captureDevices) {
- [deviceNames setObject:[device localizedDisplayName]
- forKey:[device uniqueID]];
+ if (![[device attributeForKey:QTCaptureDeviceSuspendedAttribute] boolValue])
+ [deviceNames setObject:[device localizedDisplayName]
+ forKey:[device uniqueID]];
}
}
@@ -86,6 +87,11 @@
return NO;
}
QTCaptureDevice *device = [captureDevices objectAtIndex:index];
+ if ([[device attributeForKey:QTCaptureDeviceSuspendedAttribute]
+ boolValue]) {
+ DLOG(ERROR) << "Cannot open suspended video capture device.";
+ return NO;
+ }
NSError *error;
if (![device open:&error]) {
DLOG(ERROR) << "Could not open video capture device."