Commit 2bec4640 authored by Yuelong Yu's avatar Yuelong Yu
Browse files

fixed data udp data receving problem

parent a868b958
......@@ -37,5 +37,5 @@ namespace FSDataRecvNS
typedef shared_ptr<MemPool<int16>> sptr_mem16bit;
typedef unique_ptr<NetworkInterface> uptr_network;
const int16 CHAR_BUFFER = 9000;
const int16 CHAR_BUFFER = 8192;
}
......@@ -73,6 +73,9 @@ namespace FSDataRecvNS
void ReceiverTask::SetLiveViewInterval(int32 interval)
{
LOG_TRACE(__FUNCTION__);
LOG_INFOS("live view interval : " + to_string(interval));
m_liveviewinterval = interval;
}
......@@ -96,7 +99,7 @@ namespace FSDataRecvNS
LOG_TRACE(__FUNCTION__);
//int32 frame_no;
int16 error_code;
//int16 error_code;
szt packet_size;
while(1)
......@@ -127,12 +130,14 @@ namespace FSDataRecvNS
continue;
}
error_code = m_udpconn->ReceivePacket((char*)(&m_packet),packet_size);
if(error_code != -1)
//error_code = m_udpconn->ReceivePacket((char*)(&m_packet),packet_size);
while(m_udpconn->ReceivePacket((char*)(&m_packet),packet_size) != -1)
{
if(packet_size != 8192)
LOG_STREAM(__FUNCTION__,ERROR,"packet size error : " + to_string(packet_size));
BuildImage(m_packet);
//usleep(1);
}
}
}
......@@ -164,7 +169,7 @@ namespace FSDataRecvNS
}
}
int16* data = reinterpret_cast<int16*>(&m_reordered_img[0]);
int16* data = m_reordered_img.data();
m_mempool16bit->SetImage(data,m_received_imgs,0);
//update live image
if(m_received_imgs % m_liveviewinterval == 0 && m_liveviewinterval !=-1)
......
......@@ -59,8 +59,8 @@ namespace FSDataRecvNS
*/
ReceiverTask(string udp_ip,
int16 port,
int32 x,
int32 y,
int32 x,
int32 y,
int32 img_size,
sptr_mem16bit const& mempool);
......
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