Add network traffic statistics (#4239)

Co-authored-by: xiongguangjie <xiong_panda@163.com>
Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
PioLing
2025-05-02 16:23:25 +08:00
committed by GitHub
parent ab14adb94d
commit 7b1f8fedac
35 changed files with 325 additions and 19 deletions

View File

@@ -183,9 +183,12 @@ std::string MultiMediaSourceMuxer::shortUrl() const {
return _tuple.shortUrl();
}
void MultiMediaSourceMuxer::forEachRtpSender(const std::function<void(const std::string &ssrc)> &cb) const {
void MultiMediaSourceMuxer::forEachRtpSender(const std::function<void(const std::string &ssrc, const RtpSender &sender)> &cb) const {
for (auto &pr : _rtp_sender) {
cb(pr.first);
auto sender = std::get<1>(pr.second).lock();
if (sender) {
cb(pr.first, *sender);
}
}
}
@@ -443,10 +446,11 @@ void MultiMediaSourceMuxer::startSendRtp(MediaSource &sender, const MediaSourceE
// 可能归属线程发生变更 [AUTO-TRANSLATED:2b379e30]
// The owning thread may change
strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() {
if(!ssrc_multi_send) {
if (!ssrc_multi_send) {
strong_self->_rtp_sender.erase(ssrc);
}
strong_self->_rtp_sender.emplace(ssrc,reader);
std::weak_ptr<RtpSender> sender = rtp_sender;
strong_self->_rtp_sender.emplace(ssrc, make_tuple(reader, sender));
});
});
#else