Chromium Code Reviews| Index: webrtc/pc/channel.cc |
| diff --git a/webrtc/pc/channel.cc b/webrtc/pc/channel.cc |
| index 9ac9d201ab57eecf632fdfc514bb956058b0e994..6d2e45cdc2ae3fcba551a5fd5d02335d993094bd 100644 |
| --- a/webrtc/pc/channel.cc |
| +++ b/webrtc/pc/channel.cc |
| @@ -43,7 +43,6 @@ struct SendPacketMessageData : public rtc::MessageData { |
| rtc::PacketOptions options; |
| }; |
| -#if defined(ENABLE_EXTERNAL_AUTH) |
| // Returns the named header extension if found among all extensions, |
| // nullptr otherwise. |
| const webrtc::RtpExtension* FindHeaderExtension( |
| @@ -55,7 +54,6 @@ const webrtc::RtpExtension* FindHeaderExtension( |
| } |
| return nullptr; |
| } |
| -#endif |
| } // namespace |
| @@ -736,29 +734,29 @@ bool BaseChannel::SendPacket(bool rtcp, |
| // a fake HMAC value. This is ONLY done for a RTP packet. |
| // Socket layer will update rtp sendtime extension header if present in |
| // packet with current time before updating the HMAC. |
| -#if !defined(ENABLE_EXTERNAL_AUTH) |
| - res = srtp_filter_.ProtectRtp( |
| - data, len, static_cast<int>(packet->capacity()), &len); |
| -#else |
| - updated_options.packet_time_params.rtp_sendtime_extension_id = |
| - rtp_abs_sendtime_extn_id_; |
| - res = srtp_filter_.ProtectRtp( |
| - data, len, static_cast<int>(packet->capacity()), &len, |
| - &updated_options.packet_time_params.srtp_packet_index); |
| - // If protection succeeds, let's get auth params from srtp. |
| - if (res) { |
| - uint8_t* auth_key = NULL; |
| - int key_len; |
| - res = srtp_filter_.GetRtpAuthParams( |
| - &auth_key, &key_len, |
| - &updated_options.packet_time_params.srtp_auth_tag_len); |
| + if (!srtp_filter_.AllowExternalAuth()) { |
| + res = srtp_filter_.ProtectRtp( |
| + data, len, static_cast<int>(packet->capacity()), &len); |
| + } else { |
| + updated_options.packet_time_params.rtp_sendtime_extension_id = |
| + rtp_abs_sendtime_extn_id_; |
| + res = srtp_filter_.ProtectRtp( |
| + data, len, static_cast<int>(packet->capacity()), &len, |
| + &updated_options.packet_time_params.srtp_packet_index); |
| + // If protection succeeds, let's get auth params from srtp. |
| if (res) { |
| - updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
| - updated_options.packet_time_params.srtp_auth_key.assign( |
| - auth_key, auth_key + key_len); |
| + uint8_t* auth_key = NULL; |
| + int key_len; |
| + res = srtp_filter_.GetRtpAuthParams( |
| + &auth_key, &key_len, |
| + &updated_options.packet_time_params.srtp_auth_tag_len); |
| + if (res) { |
| + updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
| + updated_options.packet_time_params.srtp_auth_key.assign( |
| + auth_key, auth_key + key_len); |
| + } |
| } |
| } |
| -#endif |
| if (!res) { |
| int seq_num = -1; |
| uint32_t ssrc = 0; |
| @@ -1460,7 +1458,6 @@ void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension_w( |
| // Absolute Send Time extension id is used only with external auth, |
| // so do not bother searching for it and making asyncronious call to set |
| // something that is not used. |
| -#if defined(ENABLE_EXTERNAL_AUTH) |
|
Taylor Brandstetter
2017/02/28 22:53:40
Replace #ifdef with "if (external_auth_enabled_)"?
|
| const webrtc::RtpExtension* send_time_extension = |
| FindHeaderExtension(extensions, webrtc::RtpExtension::kAbsSendTimeUri); |
| int rtp_abs_sendtime_extn_id = |
| @@ -1469,7 +1466,6 @@ void BaseChannel::MaybeCacheRtpAbsSendTimeHeaderExtension_w( |
| RTC_FROM_HERE, network_thread_, |
| Bind(&BaseChannel::CacheRtpAbsSendTimeHeaderExtension_n, this, |
| rtp_abs_sendtime_extn_id)); |
| -#endif |
| } |
| void BaseChannel::CacheRtpAbsSendTimeHeaderExtension_n( |