mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 16:46:28 +00:00
[c-host] improve capture reinitialization
This commit is contained in:
parent
39ac07bfde
commit
836e8a5654
33
c-host/app.c
33
c-host/app.c
@ -111,6 +111,22 @@ bool stopThreads()
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool captureStart(struct CaptureInterface * iface)
|
||||||
|
{
|
||||||
|
DEBUG_INFO("Using : %s", iface->getName());
|
||||||
|
|
||||||
|
const unsigned int maxFrameSize = iface->getMaxFrameSize();
|
||||||
|
if (maxFrameSize > app.frameSize)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Maximum frame size of %d bytes excceds maximum space available", maxFrameSize);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
DEBUG_INFO("Capture Size : %u MiB (%u)", maxFrameSize / 1048576, maxFrameSize);
|
||||||
|
|
||||||
|
DEBUG_INFO("==== [ Capture Start ] ====");
|
||||||
|
return startThreads();
|
||||||
|
}
|
||||||
|
|
||||||
int app_main(bool * termSignal)
|
int app_main(bool * termSignal)
|
||||||
{
|
{
|
||||||
unsigned int shmemSize = os_shmemSize();
|
unsigned int shmemSize = os_shmemSize();
|
||||||
@ -165,24 +181,11 @@ int app_main(bool * termSignal)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_INFO("Using : %s", iface->getName());
|
if (!captureStart(iface))
|
||||||
|
|
||||||
const unsigned int maxFrameSize = iface->getMaxFrameSize();
|
|
||||||
if (maxFrameSize > app.frameSize)
|
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Maximum frame size of %d bytes excceds maximum space available", maxFrameSize);
|
|
||||||
exitcode = -1;
|
exitcode = -1;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
DEBUG_INFO("Capture Size : %u MiB (%u)", maxFrameSize / 1048576, maxFrameSize);
|
|
||||||
|
|
||||||
DEBUG_INFO("==== [ Capture Start ] ====");
|
|
||||||
|
|
||||||
if (!startThreads())
|
|
||||||
{
|
|
||||||
exitcode = -1;
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(!*termSignal)
|
while(!*termSignal)
|
||||||
{
|
{
|
||||||
@ -211,7 +214,7 @@ int app_main(bool * termSignal)
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startThreads())
|
if (!captureStart(iface))
|
||||||
{
|
{
|
||||||
exitcode = -1;
|
exitcode = -1;
|
||||||
goto finish;
|
goto finish;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user