mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-10-31 16:47:28 +08:00
优化参数以及参数命名
This commit is contained in:
parent
bca084d080
commit
a078010f36
@ -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,
|
||||
|
@ -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<bool>()){
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user