发送GET_PARAMETER命令兼容一些rtsp服务器:#284

This commit is contained in:
xiongziliang 2020-05-09 14:04:08 +08:00
parent abe1698601
commit 91080e507c
2 changed files with 9 additions and 1 deletions

View File

@ -377,6 +377,11 @@ void RtspPlayer::sendDescribe() {
sendRtspRequest("DESCRIBE",_strUrl,{"Accept","application/sdp"}); 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){ void RtspPlayer::sendPause(int type , uint32_t seekMS){
_onHandshake = std::bind(&RtspPlayer::handleResPAUSE,this, placeholders::_1,type); _onHandshake = std::bind(&RtspPlayer::handleResPAUSE,this, placeholders::_1,type);
//开启或暂停rtsp //开启或暂停rtsp
@ -727,6 +732,9 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &pkt, const SdpTrack::Ptr &tra
sendReceiverReport(_eType == Rtsp::RTP_TCP,iTrackIndex); sendReceiverReport(_eType == Rtsp::RTP_TCP,iTrackIndex);
ticker.resetTime(); ticker.resetTime();
} }
//有些rtsp服务器需要rtcp保活有些需要发送信令保活
sendGetParameter();
} }
} }

View File

@ -99,7 +99,7 @@ private:
void sendSetup(unsigned int uiTrackIndex); void sendSetup(unsigned int uiTrackIndex);
void sendPause(int type , uint32_t ms); void sendPause(int type , uint32_t ms);
void sendDescribe(); 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 StrCaseMap &header = StrCaseMap());
void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list<string> &header); void sendRtspRequest(const string &cmd, const string &url ,const std::initializer_list<string> &header);
void sendReceiverReport(bool overTcp,int iTrackIndex); void sendReceiverReport(bool overTcp,int iTrackIndex);