From a078010f36e697b290578634ac55da4ea32e3214 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 2 Jul 2018 16:00:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=8F=82=E6=95=B0=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Device/PlayerProxy.cpp | 2 +- src/Rtsp/RtspPlayer.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Device/PlayerProxy.cpp b/src/Device/PlayerProxy.cpp index 2d318092..a9eb23df 100644 --- a/src/Device/PlayerProxy.cpp +++ b/src/Device/PlayerProxy.cpp @@ -66,7 +66,7 @@ static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, #define MUTE_ADTS_SAMPLE_RATE 8000 #define MUTE_ADTS_DATA s_mute_adts #define MUTE_ADTS_DATA_LEN sizeof(s_mute_adts) -#define MUTE_ADTS_DATA_MS 120 +#define MUTE_ADTS_DATA_MS 130 PlayerProxy::PlayerProxy(const char *strVhost, const char *strApp, diff --git a/src/Rtsp/RtspPlayer.cpp b/src/Rtsp/RtspPlayer.cpp index 5c182e57..3b21d86f 100644 --- a/src/Rtsp/RtspPlayer.cpp +++ b/src/Rtsp/RtspPlayer.cpp @@ -50,7 +50,7 @@ namespace Rtsp { onRecvRTP_l(it->second, trackidx); \ m_amapRtpSort[trackidx].erase(it); -const char kMd5Nonce[] = "md5_nonce"; +const char kRtspMd5Nonce[] = "rtsp_md5_nonce"; const char kRtspRealm[] = "rtsp_realm"; RtspPlayer::RtspPlayer(void){ @@ -69,7 +69,7 @@ void RtspPlayer::teardown(){ shutdown(); } - erase(kMd5Nonce); + erase(kRtspMd5Nonce); erase(kRtspRealm); m_uiTrackCnt = 0; m_onHandshake = nullptr; @@ -233,12 +233,12 @@ bool RtspPlayer::handleAuthenticationFailure(const string ¶msStr) { if (sscanf(paramsStr.data(), "Digest realm=\"%[^\"]\", nonce=\"%[^\"]\", stale=%[a-zA-Z]", realm, nonce, stale) == 3) { (*this)[kRtspRealm] = realm; - (*this)[kMd5Nonce] = nonce; + (*this)[kRtspMd5Nonce] = nonce; return true; } if (sscanf(paramsStr.data(), "Digest realm=\"%[^\"]\", nonce=\"%[^\"]\"", realm, nonce) == 2) { (*this)[kRtspRealm] = realm; - (*this)[kMd5Nonce] = nonce; + (*this)[kRtspMd5Nonce] = nonce; return true; } if (sscanf(paramsStr.data(), "Basic realm=\"%[^\"]\"", realm) == 1) { @@ -711,7 +711,7 @@ bool RtspPlayer::sendRtspRequest(const string &cmd, const string &url,const StrC } if(!(*this)[kRtspRealm].empty() && !(*this)[PlayerBase::kRtspUser].empty()){ - if(!(*this)[kMd5Nonce].empty()){ + if(!(*this)[kRtspMd5Nonce].empty()){ //MD5认证 /* response计算方法如下: @@ -725,12 +725,12 @@ bool RtspPlayer::sendRtspRequest(const string &cmd, const string &url,const StrC if(!(*this)[PlayerBase::kRtspPwdIsMD5].as()){ encrypted_pwd = MD5((*this)[PlayerBase::kRtspUser]+ ":" + (*this)[kRtspRealm] + ":" + encrypted_pwd).hexdigest(); } - auto response = MD5( encrypted_pwd + ":" + (*this)[kMd5Nonce] + ":" + MD5(cmd + ":" + url).hexdigest()).hexdigest(); + auto response = MD5( encrypted_pwd + ":" + (*this)[kRtspMd5Nonce] + ":" + MD5(cmd + ":" + url).hexdigest()).hexdigest(); _StrPrinter printer; printer << "Digest "; printer << "username=\"" << (*this)[PlayerBase::kRtspUser] << "\", "; printer << "realm=\"" << (*this)[kRtspRealm] << "\", "; - printer << "nonce=\"" << (*this)[kMd5Nonce] << "\", "; + printer << "nonce=\"" << (*this)[kRtspMd5Nonce] << "\", "; printer << "uri=\"" << url << "\", "; printer << "response=\"" << response << "\""; header.emplace("Authorization",printer);