mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
防止nack异步触发时对象析构导致的崩溃
This commit is contained in:
parent
b1dc285649
commit
80ab84cbb5
@ -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<WebRtcTransportImp> weak_self = dynamic_pointer_cast<WebRtcTransportImp>(shared_from_this());
|
||||
ref = std::make_shared<RtpChannel>(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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user