diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index dc44ee15..52b77a45 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -377,6 +377,11 @@ void RtspPlayer::sendDescribe() { sendRtspRequest("DESCRIBE",_strUrl,{"Accept","application/sdp"}); } +void RtspPlayer::sendGetParameter(){ + _onHandshake = [this](const Parser& parser){}; + sendRtspRequest("GET_PARAMETER",_strUrl); +} + void RtspPlayer::sendPause(int type , uint32_t seekMS){ _onHandshake = std::bind(&RtspPlayer::handleResPAUSE,this, placeholders::_1,type); //开启或暂停rtsp @@ -727,6 +732,9 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &pkt, const SdpTrack::Ptr &tra sendReceiverReport(_eType == Rtsp::RTP_TCP,iTrackIndex); ticker.resetTime(); } + + //有些rtsp服务器需要rtcp保活,有些需要发送信令保活 + sendGetParameter(); } } diff --git a/src/Rtsp/RtspPlayer.h b/src/Rtsp/RtspPlayer.h index e2830799..0e643555 100644 --- a/src/Rtsp/RtspPlayer.h +++ b/src/Rtsp/RtspPlayer.h @@ -99,7 +99,7 @@ private: void sendSetup(unsigned int uiTrackIndex); void sendPause(int type , uint32_t ms); void sendDescribe(); - + void sendGetParameter(); void sendRtspRequest(const string &cmd, const string &url ,const StrCaseMap &header = StrCaseMap()); void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list &header); void sendReceiverReport(bool overTcp,int iTrackIndex);