Browse Source

Merge pull request #283 from iturrioz/Fix-first-packet-dropped

Fix first packet dropped
Paul-Louis Ageneau 4 years ago
parent
commit
7aa2fdda6f
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/dtlssrtptransport.cpp

+ 6 - 3
src/dtlssrtptransport.cpp

@@ -206,7 +206,8 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
 					PLOG_WARNING << "SRTCP unprotect error, status=" << err
 					PLOG_WARNING << "SRTCP unprotect error, status=" << err
 					             << " SSRC=" << ((RTCP_SR *)message->data())->senderSSRC();
 					             << " SSRC=" << ((RTCP_SR *)message->data())->senderSSRC();
 				}
 				}
-				return;
+				if (err)
+					return;
 			}
 			}
 			PLOG_VERBOSE << "Unprotected SRTCP packet, size=" << size;
 			PLOG_VERBOSE << "Unprotected SRTCP packet, size=" << size;
 			message->type = Message::Type::Control;
 			message->type = Message::Type::Control;
@@ -225,10 +226,12 @@ void DtlsSrtpTransport::incoming(message_ptr message) {
 					if ((err = srtp_unprotect(mSrtpIn, message->data(), &size)))
 					if ((err = srtp_unprotect(mSrtpIn, message->data(), &size)))
 						throw std::runtime_error("SRTP unprotect error, status=" +
 						throw std::runtime_error("SRTP unprotect error, status=" +
 						                         to_string(static_cast<int>(err)));
 						                         to_string(static_cast<int>(err)));
-				} else
+				} else {
 					PLOG_WARNING << "SRTP unprotect error, status=" << err
 					PLOG_WARNING << "SRTP unprotect error, status=" << err
 					             << " SSRC=" << reinterpret_cast<RTP *>(message->data())->ssrc();
 					             << " SSRC=" << reinterpret_cast<RTP *>(message->data())->ssrc();
-				return;
+				}
+				if (err)
+					return;
 			}
 			}
 			PLOG_VERBOSE << "Unprotected SRTP packet, size=" << size;
 			PLOG_VERBOSE << "Unprotected SRTP packet, size=" << size;
 			message->type = Message::Type::Binary;
 			message->type = Message::Type::Binary;