From 80ab84cbb58dbc0dd2c6d6bd381c8e85aa2cf2d8 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Tue, 27 Jul 2021 20:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2nack=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=97=B6=E5=AF=B9=E8=B1=A1=E6=9E=90=E6=9E=84?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 54314e4e..7d40cbeb 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -760,10 +760,15 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) { void WebRtcTransportImp::createRtpChannel(const string &rid, uint32_t ssrc, const MediaTrack::Ptr &track) { //rid --> RtpReceiverImp auto &ref = track->rtp_channel[rid]; + weak_ptr weak_self = dynamic_pointer_cast(shared_from_this()); ref = std::make_shared(getPoller(),[track, this, rid](RtpPacket::Ptr rtp) mutable { onSortedRtp(*track, rid, std::move(rtp)); - }, [track, this, ssrc](const FCI_NACK &nack) mutable { - onSendNack(*track, nack, ssrc); + }, [track, weak_self, ssrc](const FCI_NACK &nack) mutable { + //nack发送可能由定时器异步触发 + auto strong_self = weak_self.lock(); + if (strong_self) { + strong_self->onSendNack(*track, nack, ssrc); + } }); InfoL << "create rtp receiver of ssrc:" << ssrc << ", rid:" << rid << ", codec:" << track->plan_rtp->codec; }