[client/obs] update to use new LGMP init api

This commit is contained in:
Geoffrey McRae 2020-05-21 09:28:41 +10:00
parent a6d6a49f82
commit 3b47a4113f
4 changed files with 43 additions and 34 deletions

View File

@ -1 +1 @@
B1-200-gf8ff3faf78+1 B1-201-ga6d6a49f82+1

View File

@ -1451,18 +1451,31 @@ static int lg_run()
lgWaitEvent(e_startup, TIMEOUT_INFINITE); lgWaitEvent(e_startup, TIMEOUT_INFINITE);
LGMP_STATUS status; LGMP_STATUS status;
uint32_t udataSize;
KVMFR *udata;
int waitCount = 0;
while(state.running) while(state.running)
{ {
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp, if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp)) == LGMP_OK)
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
break; break;
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC) DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
return -1;
}
uint32_t udataSize;
KVMFR *udata;
int waitCount = 0;
while(state.running)
{ {
if ((status = lgmpClientSessionInit(state.lgmp, &udataSize, (uint8_t **)&udata)) == LGMP_OK)
break;
if (status != LGMP_ERR_INVALID_SESSION && status != LGMP_ERR_INVALID_MAGIC)
{
DEBUG_ERROR("lgmpClientSessionInit Failed: %s", lgmpStatusString(status));
return -1;
}
if (waitCount++ == 0) if (waitCount++ == 0)
{ {
DEBUG_BREAK(); DEBUG_BREAK();
@ -1478,14 +1491,7 @@ static int lg_run()
DEBUG_INFO("Continuing to wait..."); DEBUG_INFO("Continuing to wait...");
} }
if (status == LGMP_ERR_INVALID_SESSION)
SDL_WaitEventTimeout(NULL, 1000); SDL_WaitEventTimeout(NULL, 1000);
continue;
}
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
return -1;
} }
if (!state.running) if (!state.running)
@ -1519,13 +1525,12 @@ static int lg_run()
while(state.running) while(state.running)
{ {
SDL_WaitEventTimeout(NULL, 1000);
if (!lgmpClientSessionValid(state.lgmp)) if (!lgmpClientSessionValid(state.lgmp))
{ {
DEBUG_WARN("Session is invalid, has the host shutdown?"); DEBUG_WARN("Session is invalid, has the host shutdown?");
break; break;
} }
SDL_WaitEventTimeout(NULL, 1000);
} }
return 0; return 0;

View File

@ -171,8 +171,12 @@ static void lgUpdate(void * data, obs_data_t * settings)
uint32_t udataSize; uint32_t udataSize;
KVMFR * udata; KVMFR * udata;
if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp, if (lgmpClientInit(this->shmDev.mem, this->shmDev.size, &this->lgmp)
&udataSize, (uint8_t **)&udata) != LGMP_OK) != LGMP_OK)
return;
if (lgmpClientSessionInit(this->lgmp, &udataSize, (uint8_t **)&udata)
!= LGMP_OK)
return; return;
if (udataSize != sizeof(KVMFR) || if (udataSize != sizeof(KVMFR) ||

@ -1 +1 @@
Subproject commit 520350a8af533a8ef307da13fa95a19d5ae78762 Subproject commit 19efde39f6f2d50799aabec55ca8260360711a42