rtp packet ring buffer set 4096 avoid overflow

This commit is contained in:
xiongguangjie 2024-04-16 17:37:46 +08:00
parent 3adbad5fc4
commit 3204769d5e
3 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ PSEncoderImp::PSEncoderImp(uint32_t ssrc, uint8_t payload_type, bool ps_or_ts) :
} }
} }
_rtp_encoder->setRtpInfo(ssrc, video_mtu, 90000, payload_type); _rtp_encoder->setRtpInfo(ssrc, video_mtu, 90000, payload_type);
auto ring = std::make_shared<RtpRing::RingType>(); auto ring = std::make_shared<RtpRing::RingType>(4096);
ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), is_key); })); ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), is_key); }));
_rtp_encoder->setRtpRing(std::move(ring)); _rtp_encoder->setRtpRing(std::move(ring));
InfoL << this << " " << ssrc; InfoL << this << " " << ssrc;

View File

@ -31,7 +31,7 @@ RawEncoderImp::~RawEncoderImp() {
bool RawEncoderImp::addTrack(const Track::Ptr &track) { bool RawEncoderImp::addTrack(const Track::Ptr &track) {
if (_send_audio && track->getTrackType() == TrackType::TrackAudio && !_rtp_encoder) { // audio if (_send_audio && track->getTrackType() == TrackType::TrackAudio && !_rtp_encoder) { // audio
_rtp_encoder = createRtpEncoder(track); _rtp_encoder = createRtpEncoder(track);
auto ring = std::make_shared<RtpRing::RingType>(); auto ring = std::make_shared<RtpRing::RingType>(4096);
ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), true); })); ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), true); }));
_rtp_encoder->setRtpRing(std::move(ring)); _rtp_encoder->setRtpRing(std::move(ring));
if (track->getCodecId() == CodecG711A || track->getCodecId() == CodecG711U) { if (track->getCodecId() == CodecG711A || track->getCodecId() == CodecG711U) {
@ -45,7 +45,7 @@ bool RawEncoderImp::addTrack(const Track::Ptr &track) {
if (!_send_audio && track->getTrackType() == TrackType::TrackVideo && !_rtp_encoder) { if (!_send_audio && track->getTrackType() == TrackType::TrackVideo && !_rtp_encoder) {
_rtp_encoder = createRtpEncoder(track); _rtp_encoder = createRtpEncoder(track);
auto ring = std::make_shared<RtpRing::RingType>(); auto ring = std::make_shared<RtpRing::RingType>(4096);
ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), is_key); })); ring->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr rtp, bool is_key) { onRTP(std::move(rtp), is_key); }));
_rtp_encoder->setRtpRing(std::move(ring)); _rtp_encoder->setRtpRing(std::move(ring));
return true; return true;

View File

@ -46,8 +46,8 @@ RtspMuxer::RtspMuxer(const TitleSdp::Ptr &title) {
_live = title->getDuration() == 0; _live = title->getDuration() == 0;
_sdp = title->getSdp(); _sdp = title->getSdp();
} }
_rtpRing = std::make_shared<RtpRing::RingType>(); _rtpRing = std::make_shared<RtpRing::RingType>(4096);
_rtpInterceptor = std::make_shared<RtpRing::RingType>(); _rtpInterceptor = std::make_shared<RtpRing::RingType>(4096);
_rtpInterceptor->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr in, bool is_key) { _rtpInterceptor->setDelegate(std::make_shared<RingDelegateHelper>([this](RtpPacket::Ptr in, bool is_key) {
onRtp(std::move(in), is_key); onRtp(std::move(in), is_key);
})); }));