防止重复添加RtcpContext

This commit is contained in:
xiongziliang 2021-01-31 19:56:18 +08:00
parent 51435d955c
commit 8db9f86a0a
3 changed files with 3 additions and 0 deletions

View File

@ -203,6 +203,7 @@ void RtspPlayer::handleResDESCRIBE(const Parser& parser) {
if (!onCheckSDP(sdpParser.toString())) {
throw std::runtime_error("onCheckSDP faied");
}
_rtcp_context.clear();
for (auto &track : _sdp_track) {
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, true));
}

View File

@ -176,6 +176,7 @@ void RtspPusher::sendAnnounce() {
if (_track_vec.empty()) {
throw std::runtime_error("无有效的Sdp Track");
}
_rtcp_context.clear();
for (auto &track : _track_vec) {
_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false));
}

View File

@ -406,6 +406,7 @@ void RtspSession::onAuthSuccess() {
strongSelf->shutdown(SockException(Err_shutdown,"can not find any available track in sdp"));
return;
}
strongSelf->_rtcp_context.clear();
for (auto &track : strongSelf->_sdp_track) {
strongSelf->_rtcp_context.emplace_back(std::make_shared<RtcpContext>(track->_samplerate, false));
}