Good day.
I'm developing an application that transfer video
data and there is problem with transfer big data chunk (~600 Kb) over UDP. Data
processing consumes 50% CPU and performance is not good ( i need transfer 25
chunks in sec, but really there is about 18).
Below is code snippet:
.......
// Get video data chunk
void Receive(ISample* pSample)
{
// Divide chunk on
RTP packets
IPacketIterator* iter =
m_accessor->GetIterator(pSample);
SendDatagram(iter);
}
// Send datagram
void SendDatagram(IPacketIterator*
iter)
{
if
(iter->IsValid())
{
IProtocolPacket* packet = iter->Next();
std::vector<asio::const_buffer> buffs(2);
buffs.push_back(asio::const_buffer(packet->GetHeader(),
packet->GetHeaderSize());
buffs.push_back(asio::const_buffer(packet->GetBody(),
packet->GetBodySize());
m_socket.async_send_to(buffs, m_endpoint,
boost::bind(&CChannel::handle_send, this,
iter,
placeholders::error,
placeholders::bytes_transferred);
}
else
{
// Query next
chunk
........
}
}
void handle_send(IPacketIterator* iter,
const boost::system::error_code& error, size_t
bytes_trans)
{
if (!error)
SendDatagram(iter);
}
Anyone can help me with that
problem?
Best regards,
Vadim