diff --git a/src/impl/dtlssrtptransport.cpp b/src/impl/dtlssrtptransport.cpp index f450bffdb..fef02fad8 100644 --- a/src/impl/dtlssrtptransport.cpp +++ b/src/impl/dtlssrtptransport.cpp @@ -326,11 +326,13 @@ void DtlsSrtpTransport::postHandshake() { std::memcpy(mServerSessionKey.data() + keySize, serverSalt, saltSize); srtp_policy_t inbound = {}; - srtp_crypto_policy_set_from_profile_for_rtp(&inbound.rtp, srtpProfile); - srtp_crypto_policy_set_from_profile_for_rtcp(&inbound.rtcp, srtpProfile); + if(srtp_crypto_policy_set_from_profile_for_rtp(&inbound.rtp, srtpProfile)) + throw std::runtime_error("SRTP profile is not supported"); + if(srtp_crypto_policy_set_from_profile_for_rtcp(&inbound.rtcp, srtpProfile)) + throw std::runtime_error("SRTP profile is not supported"); + inbound.ssrc.type = ssrc_any_inbound; inbound.key = mIsClient ? mServerSessionKey.data() : mClientSessionKey.data(); - inbound.window_size = 1024; inbound.allow_repeat_tx = true; inbound.next = nullptr; @@ -340,8 +342,11 @@ void DtlsSrtpTransport::postHandshake() { to_string(static_cast(err))); srtp_policy_t outbound = {}; - srtp_crypto_policy_set_from_profile_for_rtp(&outbound.rtp, srtpProfile); - srtp_crypto_policy_set_from_profile_for_rtcp(&outbound.rtcp, srtpProfile); + if(srtp_crypto_policy_set_from_profile_for_rtp(&outbound.rtp, srtpProfile)) + throw std::runtime_error("SRTP profile is not supported"); + if(srtp_crypto_policy_set_from_profile_for_rtcp(&outbound.rtcp, srtpProfile)) + throw std::runtime_error("SRTP profile is not supported"); + outbound.ssrc.type = ssrc_any_outbound; outbound.key = mIsClient ? mClientSessionKey.data() : mServerSessionKey.data(); outbound.window_size = 1024;