Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
......@@ -98,14 +98,16 @@ void VideoDeviceMonitorImpl::start()
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
AVCaptureDevice* dev = (AVCaptureDevice*)note.object;
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;
auto dev = (AVCaptureDevice*)note.object;
if([dev hasMediaType:AVMediaTypeVideo])
monitor_->removeDevice([[dev uniqueID] UTF8String]);
}];
observers = [[NSArray alloc] initWithObjects:deviceWasConnectedObserver, deviceWasDisconnectedObserver, nil];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment