From 1539e4ed60098ee9027d36244967a7bf1d0b489b Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Tue, 2 Feb 2021 10:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96rtsp=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspPusher.cpp | 6 ++---- src/Rtsp/RtspSession.cpp | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Rtsp/RtspPusher.cpp b/src/Rtsp/RtspPusher.cpp index 4dde91a3..abde7063 100644 --- a/src/Rtsp/RtspPusher.cpp +++ b/src/Rtsp/RtspPusher.cpp @@ -398,8 +398,7 @@ void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) { if (++i == size) { setSendFlushFlag(true); } - BufferRtp::Ptr buffer(new BufferRtp(rtp)); - send(std::move(buffer)); + send(rtp); }); break; } @@ -416,8 +415,7 @@ void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) { return; } - BufferRtp::Ptr buffer(new BufferRtp(rtp, 4)); - pSock->send(std::move(buffer), nullptr, 0, ++i == size); + pSock->send(std::make_shared(rtp, RtpPacket::kRtpTcpHeaderSize), nullptr, 0, ++i == size); }); break; } diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 781732d1..23be644e 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -1178,9 +1178,8 @@ void RtspSession::sendRtpPacket(const RtspMediaSource::RingDataType &pkt) { shutdown(SockException(Err_shutdown, "udp sock not opened yet")); return; } - BufferRtp::Ptr buffer(new BufferRtp(rtp, 4)); - _bytes_usage += buffer->size(); - pSock->send(std::move(buffer), nullptr, 0, ++i == size); + _bytes_usage += rtp->size() - RtpPacket::kRtpTcpHeaderSize; + pSock->send(std::make_shared(rtp, RtpPacket::kRtpTcpHeaderSize), nullptr, 0, ++i == size); }); } break;