From 91080e507cdd753f79f8dcef5dd2b9aa25f4126c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 9 May 2020 14:04:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E9=80=81GET=5FPARAMETER=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=85=BC=E5=AE=B9=E4=B8=80=E4=BA=9Brtsp=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8:#284?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtspPlayer.cpp | 8 ++++++++ src/Rtsp/RtspPlayer.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) 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);