Commit 70c84b35 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

video: verify AVDevice type

This commit adds type verification when an AVCaptureDevice is added.
The notification that a new device got connected, is received for both
video and audio devices.

Change-Id: Id48fb4182589234df164ab6337fb5d4863987a15
Tuleap: #149
parent e0676bf0
......@@ -98,15 +98,17 @@ void VideoDeviceMonitorImpl::start()
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
AVCaptureDevice* dev = (AVCaptureDevice*)note.object;
monitor_->addDevice([[dev uniqueID] UTF8String]);
auto dev = (AVCaptureDevice*)note.object;
if([dev hasMediaType:AVMediaTypeVideo])
monitor_->addDevice([[dev uniqueID] UTF8String]);
}];
id deviceWasDisconnectedObserver = [notificationCenter addObserverForName:AVCaptureDeviceWasDisconnectedNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
AVCaptureDevice* dev = (AVCaptureDevice*)note.object;
monitor_->removeDevice([[dev uniqueID] UTF8String]);
auto dev = (AVCaptureDevice*)note.object;
if([dev hasMediaType:AVMediaTypeVideo])
monitor_->removeDevice([[dev uniqueID] UTF8String]);
}];
observers = [[NSArray alloc] initWithObjects:deviceWasConnectedObserver, deviceWasDisconnectedObserver, nil];
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment