mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 22:55:52 +08:00
去除rtp_sender_mtx
This commit is contained in:
parent
56b8a86032
commit
7852fdc215
@ -230,7 +230,6 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &, const MediaSourceEvent::
|
|||||||
rtp_sender->addTrack(track);
|
rtp_sender->addTrack(track);
|
||||||
}
|
}
|
||||||
rtp_sender->addTrackCompleted();
|
rtp_sender->addTrackCompleted();
|
||||||
lock_guard<mutex> lck(strong_self->_rtp_sender_mtx);
|
|
||||||
strong_self->_rtp_sender[args.ssrc] = rtp_sender;
|
strong_self->_rtp_sender[args.ssrc] = rtp_sender;
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
@ -249,13 +248,11 @@ bool MultiMediaSourceMuxer::stopSendRtp(MediaSource &sender, const string &ssrc)
|
|||||||
}
|
}
|
||||||
if (ssrc.empty()) {
|
if (ssrc.empty()) {
|
||||||
//关闭全部
|
//关闭全部
|
||||||
lock_guard<mutex> lck(_rtp_sender_mtx);
|
|
||||||
auto size = _rtp_sender.size();
|
auto size = _rtp_sender.size();
|
||||||
_rtp_sender.clear();
|
_rtp_sender.clear();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
//关闭特定的
|
//关闭特定的
|
||||||
lock_guard<mutex> lck(_rtp_sender_mtx);
|
|
||||||
return _rtp_sender.erase(ssrc);
|
return _rtp_sender.erase(ssrc);
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
@ -340,7 +337,6 @@ void MultiMediaSourceMuxer::resetTracks() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_RTPPROXY)
|
#if defined(ENABLE_RTPPROXY)
|
||||||
lock_guard<mutex> lck(_rtp_sender_mtx);
|
|
||||||
for (auto &pr : _rtp_sender) {
|
for (auto &pr : _rtp_sender) {
|
||||||
pr.second->resetTracks();
|
pr.second->resetTracks();
|
||||||
}
|
}
|
||||||
@ -447,7 +443,6 @@ bool MultiMediaSourceMuxer::onTrackFrame(const Frame::Ptr &frame_in) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENABLE_RTPPROXY)
|
#if defined(ENABLE_RTPPROXY)
|
||||||
lock_guard<mutex> lck(_rtp_sender_mtx);
|
|
||||||
for (auto &pr : _rtp_sender) {
|
for (auto &pr : _rtp_sender) {
|
||||||
ret = pr.second->inputFrame(frame) ? true : ret;
|
ret = pr.second->inputFrame(frame) ? true : ret;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,6 @@ private:
|
|||||||
std::weak_ptr<Listener> _track_listener;
|
std::weak_ptr<Listener> _track_listener;
|
||||||
std::function<std::string()> _get_origin_url;
|
std::function<std::string()> _get_origin_url;
|
||||||
#if defined(ENABLE_RTPPROXY)
|
#if defined(ENABLE_RTPPROXY)
|
||||||
std::mutex _rtp_sender_mtx;
|
|
||||||
std::unordered_map<std::string, RtpSender::Ptr> _rtp_sender;
|
std::unordered_map<std::string, RtpSender::Ptr> _rtp_sender;
|
||||||
#endif //ENABLE_RTPPROXY
|
#endif //ENABLE_RTPPROXY
|
||||||
|
|
||||||
|
@ -277,5 +277,9 @@ std::shared_ptr<SockInfo> RtpProcess::getOriginSock(MediaSource &sender) const {
|
|||||||
return const_cast<RtpProcess *>(this)->shared_from_this();
|
return const_cast<RtpProcess *>(this)->shared_from_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toolkit::EventPoller::Ptr RtpProcess::getOwnerPoller(MediaSource &sender) {
|
||||||
|
return _sock ? _sock->getPoller() : MediaSourceEvent::getOwnerPoller(sender);
|
||||||
|
}
|
||||||
|
|
||||||
}//namespace mediakit
|
}//namespace mediakit
|
||||||
#endif//defined(ENABLE_RTPPROXY)
|
#endif//defined(ENABLE_RTPPROXY)
|
@ -76,6 +76,7 @@ protected:
|
|||||||
MediaOriginType getOriginType(MediaSource &sender) const override;
|
MediaOriginType getOriginType(MediaSource &sender) const override;
|
||||||
std::string getOriginUrl(MediaSource &sender) const override;
|
std::string getOriginUrl(MediaSource &sender) const override;
|
||||||
std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override;
|
std::shared_ptr<SockInfo> getOriginSock(MediaSource &sender) const override;
|
||||||
|
toolkit::EventPoller::Ptr getOwnerPoller(MediaSource &sender) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void emitOnPublish();
|
void emitOnPublish();
|
||||||
|
Loading…
Reference in New Issue
Block a user