Skip to content
Snippets Groups Projects
Commit 3db5a908 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

video: start device event listener when device list is empty

This patch fix video device detection. Before device event listeners
would not start if a video device list is empty.

Change-Id: I5b320c1ae47b945d6f570e3cd2afcd6bd01dfdae
parent 53cf11bd
No related branches found
No related tags found
No related merge requests found
......@@ -71,15 +71,10 @@ void VideoDeviceMonitorImpl::start()
auto myVideoDevices = [[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]
arrayByAddingObjectsFromArray:
[AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed]];
if ( [myVideoDevices count] == 0 )
{
JAMI_ERR("Can't find any suitable video device");
return;
}
int deviceCount = [myVideoDevices count];
int ivideo;
for ( ivideo = 0; ivideo < deviceCount; ++ivideo )
if (deviceCount > 0)
{
for (int ivideo = 0; ivideo < deviceCount; ++ivideo)
{
AVCaptureDevice* avf_device = [myVideoDevices objectAtIndex:ivideo];
printf("avcapture %d/%d %s %s\n", ivideo + 1,
......@@ -92,6 +87,7 @@ void VideoDeviceMonitorImpl::start()
JAMI_ERR("%s", e.what());
}
}
}
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
id deviceWasConnectedObserver = [notificationCenter addObserverForName:AVCaptureDeviceWasConnectedNotification
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment