diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index df930a52..9ee8adb0 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -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(track->_samplerate, true)); } diff --git a/src/Rtsp/RtspPusher.cpp b/src/Rtsp/RtspPusher.cpp index 4accfcca..4dde91a3 100644 --- a/src/Rtsp/RtspPusher.cpp +++ b/src/Rtsp/RtspPusher.cpp @@ -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(track->_samplerate, false)); } diff --git a/src/Rtsp/RtspSession.cpp b/src/Rtsp/RtspSession.cpp index 264e7d1d..781732d1 100644 --- a/src/Rtsp/RtspSession.cpp +++ b/src/Rtsp/RtspSession.cpp @@ -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(track->_samplerate, false)); }