Commit d121d677 authored by Rossa, Lutz's avatar Rossa, Lutz
Browse files

handle E_NO_FRAME (no image available) differently inside background thread

parent 29f6cb28
......@@ -749,6 +749,8 @@ int XenethCamera::SnapImage()
m_abyImage.resize(XC_GetFrameSize(m_hCamera), 0);
}
m_bDoCameraThread = false;
if (!m_byCameraTrigger)
m_byCameraTrigger = 1;
m_hMutex.unlock();
while (m_bInitialized && m_pCameraThread && !m_bDoCameraThread && m_byCameraTrigger)
std::this_thread::sleep_for(std::chrono::milliseconds(20));
......@@ -766,18 +768,23 @@ void XenethCamera::CameraThread()
{
m_abyImageTmp.resize(XC_GetFrameSize(m_hCamera), 0);
ErrCode dwErr(XC_GetFrame(m_hCamera, FT_NATIVE, 0, static_cast<void*>(m_abyImageTmp.data()), static_cast<int>(m_abyImageTmp.size())));
m_iLastCameraResult = ConvertXenethResult(dwErr);
if (dwErr == I_OK)
{
m_abyImage.swap(m_abyImageTmp);
if (m_byCameraTrigger > 0)
--m_byCameraTrigger;
}
else
int iResult(ConvertXenethResult(dwErr));
switch (dwErr)
{
LOG(("XenethCamera::CameraThread(%p) camera error %u, iResult=%d\n", this, dwErr, m_iLastCameraResult));
if (m_byCameraTrigger > 0)
m_byCameraTrigger = 1;
case I_OK:
m_iLastCameraResult = iResult;
m_abyImage.swap(m_abyImageTmp);
if (m_byCameraTrigger > 0)
--m_byCameraTrigger;
break;
case E_NO_FRAME:
break;
default:
m_iLastCameraResult = iResult;
LOG(("XenethCamera::CameraThread(%p) camera error %u, iResult=%d\n", this, dwErr, m_iLastCameraResult));
if (m_byCameraTrigger > 0)
m_byCameraTrigger = 1;
break;
}
}
m_bDoCameraThread = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment