优化rtp统计性能

This commit is contained in:
xiongziliang
2021-01-31 19:55:47 +08:00
parent 070bf19cb5
commit 51435d955c
5 changed files with 79 additions and 53 deletions

View File

@@ -235,8 +235,9 @@ void RtspSession::handleReq_ANNOUNCE(const Parser &parser) {
sendRtspResponse("403 Forbidden", {"Content-Type", "text/plain"}, err);
throw SockException(Err_shutdown,StrPrinter << err << ":" << full_url);
}
_rtcp_context.clear();
for (auto &track : _sdp_track) {
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate));
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, true));
}
_push_src = std::make_shared<RtspMediaSourceImp>(_media_info._vhost, _media_info._app, _media_info._streamid);
_push_src->setListener(dynamic_pointer_cast<MediaSourceEvent>(shared_from_this()));
@@ -406,7 +407,7 @@ void RtspSession::onAuthSuccess() {
return;
}
for (auto &track : strongSelf->_sdp_track) {
strongSelf->_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate));
strongSelf->_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false));
}
strongSelf->_sessionid = makeRandStr(12);
strongSelf->_play_src = rtsp_src;