[host] syncronization improvements

This commit is contained in:
Geoffrey McRae 2017-11-28 15:18:22 +11:00
parent f767f32a32
commit 3bc6f29dc3

View file

@ -145,34 +145,6 @@ bool Service::Process()
return false;
}
// wait for the host to notify that is it is ready to proceed
bool eventDone = false;
while (!eventDone)
{
switch (WaitForSingleObject(m_readyEvent, 1000))
{
case WAIT_ABANDONED:
DEBUG_ERROR("Wait abandoned");
return false;
case WAIT_OBJECT_0:
eventDone = true;
break;
// if we timed out we just continue to ring until we get an answer or we are stopped
case WAIT_TIMEOUT:
continue;
case WAIT_FAILED:
DEBUG_ERROR("Wait failed");
return false;
default:
DEBUG_ERROR("Unknown error");
return false;
}
}
// copy the frame details into the header
header->width = frame.width;
header->height = frame.height;
@ -193,6 +165,33 @@ bool Service::Process()
return false;
}
// wait for the host to notify that is it is ready to proceed
bool eventDone = false;
while (!eventDone)
{
switch (WaitForSingleObject(m_readyEvent, 1000))
{
case WAIT_ABANDONED:
DEBUG_ERROR("Wait abandoned");
return false;
case WAIT_OBJECT_0:
eventDone = true;
break;
case WAIT_TIMEOUT:
continue;
case WAIT_FAILED:
DEBUG_ERROR("Wait failed");
return false;
default:
DEBUG_ERROR("Unknown error");
return false;
}
}
if (++m_frameIndex == 2)
m_frameIndex = 0;