[host] app: cleanup local variables during init.

This commit is contained in:
Geoffrey McRae 2023-10-21 22:03:22 +11:00
parent 6b65c7e339
commit ad65561511

View File

@ -815,6 +815,7 @@ int app_main(int argc, char * argv[])
int throttleUs = throttleFps ? 1000000 / throttleFps : 0; int throttleUs = throttleFps ? 1000000 / throttleFps : 0;
uint64_t previousFrameTime = 0; uint64_t previousFrameTime = 0;
{
const char * ifaceName = option_get_string("app", "capture"); const char * ifaceName = option_get_string("app", "capture");
CaptureInterface * iface = NULL; CaptureInterface * iface = NULL;
for(int i = 0; CaptureInterfaces[i]; ++i) for(int i = 0; CaptureInterfaces[i]; ++i)
@ -853,6 +854,7 @@ int app_main(int argc, char * argv[])
"Asynchronous" : "Synchronous"); "Asynchronous" : "Synchronous");
app.iface = iface; app.iface = iface;
}
if (!lgmpSetup(&shmDev)) if (!lgmpSetup(&shmDev))
{ {
@ -928,14 +930,14 @@ int app_main(int argc, char * argv[])
} }
const uint64_t captureStart = microtime(); const uint64_t captureStart = microtime();
switch(iface->capture()) switch(app.iface->capture())
{ {
case CAPTURE_RESULT_OK: case CAPTURE_RESULT_OK:
previousFrameTime = captureStart; previousFrameTime = captureStart;
break; break;
case CAPTURE_RESULT_TIMEOUT: case CAPTURE_RESULT_TIMEOUT:
if (!iface->asyncCapture) if (!app.iface->asyncCapture)
if (app.frameValid && lgmpHostQueueNewSubs(app.frameQueue) > 0) if (app.frameValid && lgmpHostQueueNewSubs(app.frameQueue) > 0)
{ {
LGMP_STATUS status; LGMP_STATUS status;
@ -956,7 +958,7 @@ int app_main(int argc, char * argv[])
goto fail_capture; goto fail_capture;
} }
if (!iface->asyncCapture) if (!app.iface->asyncCapture)
sendFrame(); sendFrame();
} }
@ -987,7 +989,7 @@ fail_threads:
captureStop(); captureStop();
fail_capture: fail_capture:
iface->free(); app.iface->free();
LG_LOCK_FREE(app.pointerLock); LG_LOCK_FREE(app.pointerLock);
fail_lgmp: fail_lgmp: