|
Boost Users : |
Subject: [Boost-users] Bad performance over UDP and ASIO
From: Vadim Shmelev (vadim.shmelev_at_[hidden])
Date: 2008-12-19 04:39:07
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net