线程控制部分代码
c++11中的方法
m_Worker = std::make_shared<Linkface::SimpleWorker>([&](){
int len = m_Buffer.DataLen();
if(len <= 0) return;
BYTE * buffer = new BYTE[len];
m_Buffer.ReadTilFinish(buffer,len);
if (m_lPort != -1)
{
if (!PlayM4_InputData(m_lPort, buffer, len))
{
LOG(ERROR)<<"PlayM4_InputData failed!";
delete [] buffer;
return;
}
}
delete [] buffer;
});
调用部分:
void HCIPCamera::HandleRealData(DWORD dataType, BYTE* buffer, DWORD bufferSize)
{
switch (dataType)
{
case NET_DVR_SYSHEAD:
if (bufferSize > 0)
{
if(m_lPort>=0)
{
break;
}
if (!PlayM4_GetPort(&m_l