修复rtp组播性能问题

This commit is contained in:
xiongziliang 2020-08-08 12:17:43 +08:00
parent 2fd567b8b0
commit 0087f50aaa

View File

@ -114,9 +114,8 @@ RtpMultiCaster::RtpMultiCaster(const EventPoller::Ptr &poller,const string &strL
int i = 0; int i = 0;
int size = pkt->size(); int size = pkt->size();
pkt->for_each([&](const RtpPacket::Ptr &rtp) { pkt->for_each([&](const RtpPacket::Ptr &rtp) {
int i = (int) (rtp->type); auto &pSock = _apUdpSock[rtp->type];
auto &pSock = _apUdpSock[i]; auto &peerAddr = _aPeerUdpAddr[rtp->type];
auto &peerAddr = _aPeerUdpAddr[i];
BufferRtp::Ptr buffer(new BufferRtp(rtp, 4)); BufferRtp::Ptr buffer(new BufferRtp(rtp, 4));
pSock->send(buffer, nullptr, 0, ++i == size); pSock->send(buffer, nullptr, 0, ++i == size);
}); });