mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 19:51:49 +08:00
startSendRtp接口支持rtcp接收超时主动停止
This commit is contained in:
@@ -223,7 +223,7 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &, const MediaSourceEvent::
|
||||
#if defined(ENABLE_RTPPROXY)
|
||||
auto rtp_sender = std::make_shared<RtpSender>();
|
||||
weak_ptr<MultiMediaSourceMuxer> weak_self = shared_from_this();
|
||||
rtp_sender->startSend(args, [args, weak_self, rtp_sender, cb](uint16_t local_port, const SockException &ex) {
|
||||
rtp_sender->startSend(args, [args, weak_self, rtp_sender, cb](uint16_t local_port, const SockException &ex) mutable {
|
||||
cb(local_port, ex);
|
||||
auto strong_self = weak_self.lock();
|
||||
if (!strong_self || ex) {
|
||||
@@ -233,7 +233,15 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &, const MediaSourceEvent::
|
||||
rtp_sender->addTrack(track);
|
||||
}
|
||||
rtp_sender->addTrackCompleted();
|
||||
strong_self->_rtp_sender[args.ssrc] = rtp_sender;
|
||||
|
||||
auto ssrc = args.ssrc;
|
||||
rtp_sender->setOnClose([weak_self, ssrc]() {
|
||||
if (auto strong_self = weak_self.lock()) {
|
||||
strong_self->_rtp_sender.erase(ssrc);
|
||||
WarnL << "stream:" << strong_self->_get_origin_url() << " stop send rtp:" << ssrc;
|
||||
}
|
||||
});
|
||||
strong_self->_rtp_sender[args.ssrc] = std::move(rtp_sender);
|
||||
});
|
||||
#else
|
||||
cb(0, SockException(Err_other, "该功能未启用,编译时请打开ENABLE_RTPPROXY宏"));
|
||||
|
||||
Reference in New Issue
Block a user