Make WebRTC replayed packets no longer print messages, removed duplicate error messages
Change-Id: If9e13c802fd9ffa5296475ec730a76fbb0667a2b
This commit is contained in:
parent
e9ea839996
commit
4e69250e69
2 changed files with 8 additions and 4 deletions
|
@ -1228,9 +1228,9 @@ namespace Mist{
|
||||||
int len = udp.data.size();
|
int len = udp.data.size();
|
||||||
if (srtpReader.unprotectRtp((uint8_t *)(char*)udp.data, &len) != 0){
|
if (srtpReader.unprotectRtp((uint8_t *)(char*)udp.data, &len) != 0){
|
||||||
if (packetLog.is_open()){packetLog << "[" << Util::bootMS() << "]" << "RTP decrypt failure" << std::endl;}
|
if (packetLog.is_open()){packetLog << "[" << Util::bootMS() << "]" << "RTP decrypt failure" << std::endl;}
|
||||||
FAIL_MSG("Failed to unprotect a RTP packet.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!len){return;}
|
||||||
lastRecv = Util::bootMS();
|
lastRecv = Util::bootMS();
|
||||||
RTP::Packet unprotPack(udp.data, len);
|
RTP::Packet unprotPack(udp.data, len);
|
||||||
DONTEVEN_MSG("%s", unprotPack.toString().c_str());
|
DONTEVEN_MSG("%s", unprotPack.toString().c_str());
|
||||||
|
@ -1262,9 +1262,9 @@ namespace Mist{
|
||||||
if (doDTLS){
|
if (doDTLS){
|
||||||
if (srtpReader.unprotectRtcp((uint8_t *)(char*)udp.data, &len) != 0){
|
if (srtpReader.unprotectRtcp((uint8_t *)(char*)udp.data, &len) != 0){
|
||||||
if (packetLog.is_open()){packetLog << "[" << Util::bootMS() << "]" << "RTCP decrypt failure" << std::endl;}
|
if (packetLog.is_open()){packetLog << "[" << Util::bootMS() << "]" << "RTCP decrypt failure" << std::endl;}
|
||||||
FAIL_MSG("Failed to unprotect RTCP.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!len){return;}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastRecv = Util::bootMS();
|
lastRecv = Util::bootMS();
|
||||||
|
|
|
@ -151,10 +151,12 @@ int SRTPReader::unprotectRtp(uint8_t *data, int *nbytes){
|
||||||
}
|
}
|
||||||
|
|
||||||
srtp_err_status_t status = srtp_unprotect(session, data, nbytes);
|
srtp_err_status_t status = srtp_unprotect(session, data, nbytes);
|
||||||
if (srtp_err_status_ok != status){
|
if (srtp_err_status_ok != status && status != srtp_err_status_replay_fail){
|
||||||
ERROR_MSG("Failed to unprotect the given SRTP. %s.", srtp_status_to_string(status).c_str());
|
ERROR_MSG("Failed to unprotect the given SRTP. %s.", srtp_status_to_string(status).c_str());
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
//For replayed packets, set bytes to zero
|
||||||
|
if (status == srtp_err_status_replay_fail){*nbytes = 0;}
|
||||||
|
|
||||||
DONTEVEN_MSG("Unprotected SRTP into %d bytes.", *nbytes);
|
DONTEVEN_MSG("Unprotected SRTP into %d bytes.", *nbytes);
|
||||||
|
|
||||||
|
@ -184,10 +186,12 @@ int SRTPReader::unprotectRtcp(uint8_t *data, int *nbytes){
|
||||||
}
|
}
|
||||||
|
|
||||||
srtp_err_status_t status = srtp_unprotect_rtcp(session, data, nbytes);
|
srtp_err_status_t status = srtp_unprotect_rtcp(session, data, nbytes);
|
||||||
if (srtp_err_status_ok != status){
|
if (srtp_err_status_ok != status && status != srtp_err_status_replay_fail){
|
||||||
ERROR_MSG("Failed to unprotect the given SRTCP. %s.", srtp_status_to_string(status).c_str());
|
ERROR_MSG("Failed to unprotect the given SRTCP. %s.", srtp_status_to_string(status).c_str());
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
//For replayed packets, set bytes to zero
|
||||||
|
if (status == srtp_err_status_replay_fail){*nbytes = 0;}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue