Commit 8db9f86a by xiongziliang

防止重复添加RtcpContext

parent 51435d95
...@@ -203,6 +203,7 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) { ...@@ -203,6 +203,7 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) {
if (!onCheckSDP(sdpParser.toString())) { if (!onCheckSDP(sdpParser.toString())) {
throw std::runtime_error("onCheckSDP faied"); throw std::runtime_error("onCheckSDP faied");
} }
_rtcp_context.clear();
for (auto &track : _sdp_track) { for (auto &track : _sdp_track) {
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, true)); _rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, true));
} }
......
...@@ -176,6 +176,7 @@ void RtspPusher::sendAnnounce() { ...@@ -176,6 +176,7 @@ void RtspPusher::sendAnnounce() {
if (_track_vec.empty()) { if (_track_vec.empty()) {
throw std::runtime_error("无有效的Sdp Track"); throw std::runtime_error("无有效的Sdp Track");
} }
_rtcp_context.clear();
for (auto &track : _track_vec) { for (auto &track : _track_vec) {
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false)); _rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false));
} }
......
...@@ -406,6 +406,7 @@ void RtspSession::onAuthSuccess() { ...@@ -406,6 +406,7 @@ void RtspSession::onAuthSuccess() {
strongSelf->shutdown(SockException(Err_shutdown,"can not find any available track in sdp")); strongSelf->shutdown(SockException(Err_shutdown,"can not find any available track in sdp"));
return; return;
} }
strongSelf->_rtcp_context.clear();
for (auto &track : strongSelf->_sdp_track) { for (auto &track : strongSelf->_sdp_track) {
strongSelf->_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false)); strongSelf->_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论