优化rtsp性能

This commit is contained in:
xia-chu 2021-02-02 10:33:56 +08:00
parent e4126809a6
commit 1539e4ed60
2 changed files with 4 additions and 7 deletions

View File

@ -398,8 +398,7 @@ void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) {
if (++i == size) { if (++i == size) {
setSendFlushFlag(true); setSendFlushFlag(true);
} }
BufferRtp::Ptr buffer(new BufferRtp(rtp)); send(rtp);
send(std::move(buffer));
}); });
break; break;
} }
@ -416,8 +415,7 @@ void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) {
return; return;
} }
BufferRtp::Ptr buffer(new BufferRtp(rtp, 4)); pSock->send(std::make_shared<BufferRtp>(rtp, RtpPacket::kRtpTcpHeaderSize), nullptr, 0, ++i == size);
pSock->send(std::move(buffer), nullptr, 0, ++i == size);
}); });
break; break;
} }

View File

@ -1178,9 +1178,8 @@ void RtspSession::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) {
shutdown(SockException(Err_shutdown, "udp sock not opened yet")); shutdown(SockException(Err_shutdown, "udp sock not opened yet"));
return; return;
} }
BufferRtp::Ptr buffer(new BufferRtp(rtp, 4)); _bytes_usage += rtp->size() - RtpPacket::kRtpTcpHeaderSize;
_bytes_usage += buffer->size(); pSock->send(std::make_shared<BufferRtp>(rtp, RtpPacket::kRtpTcpHeaderSize), nullptr, 0, ++i == size);
pSock->send(std::move(buffer), nullptr, 0, ++i == size);
}); });
} }
break; break;