[host] don't stop the timer when restarting capture

This commit is contained in:
Geoffrey McRae 2020-08-03 12:04:14 +10:00
parent aa32c5ffad
commit 9e3a42cb62

View File

@ -206,12 +206,6 @@ static int frameThread(void * opaque)
bool startThreads() bool startThreads()
{ {
app.running = true; app.running = true;
if (!lgCreateTimer(100, lgmpTimer, NULL, &app.lgmpTimer))
{
DEBUG_ERROR("Failed to create the LGMP timer");
return false;
}
if (!lgCreateThread("FrameThread", frameThread, NULL, &app.frameThread)) if (!lgCreateThread("FrameThread", frameThread, NULL, &app.frameThread))
{ {
DEBUG_ERROR("Failed to create the frame thread"); DEBUG_ERROR("Failed to create the frame thread");
@ -235,12 +229,6 @@ bool stopThreads()
} }
app.frameThread = NULL; app.frameThread = NULL;
if (app.lgmpTimer)
{
lgTimerDestroy(app.lgmpTimer);
app.lgmpTimer = NULL;
}
return ok; return ok;
} }
@ -539,6 +527,12 @@ int app_main(int argc, char * argv[])
LG_LOCK_INIT(app.pointerLock); LG_LOCK_INIT(app.pointerLock);
if (!lgCreateTimer(100, lgmpTimer, NULL, &app.lgmpTimer))
{
DEBUG_ERROR("Failed to create the LGMP timer");
goto fail;
}
if (!captureStart()) if (!captureStart())
{ {
exitcode = -1; exitcode = -1;
@ -587,8 +581,9 @@ int app_main(int argc, char * argv[])
finish: finish:
stopThreads(); stopThreads();
exit:
exit:
lgTimerDestroy(app.lgmpTimer);
LG_LOCK_FREE(app.pointerLock); LG_LOCK_FREE(app.pointerLock);
iface->deinit(); iface->deinit();