Avoid triggering a false error logging when using encryptor and sending DTX.

Bug: b/135554070
Change-Id: I82e97da6fedd3fdbe90176dbec8eda524ad20624
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143170
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28351}
This commit is contained in:
Minyue Li
2019-06-20 23:37:02 +02:00
committed by Commit Bot
parent 59b8654045
commit f48bca7bae

View File

@ -516,7 +516,8 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
// DTMF, or the encoder entered DTX.
// TODO(minyue): see whether DTMF packets should be encrypted or not. In
// current implementation, they are not.
if (frame_encryptor_ != nullptr && !payload.empty()) {
if (!payload.empty()) {
if (frame_encryptor_ != nullptr) {
// TODO(benwright@webrtc.org) - Allocate enough to always encrypt inline.
// Allocate a buffer to hold the maximum possible encrypted payload.
size_t max_ciphertext_size = frame_encryptor_->GetMaxCiphertextByteSize(
@ -530,7 +531,8 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
/*additional_data=*/nullptr, payload, encrypted_audio_payload,
&bytes_written);
if (encrypt_status != 0) {
RTC_DLOG(LS_ERROR) << "Channel::SendData() failed encrypt audio payload: "
RTC_DLOG(LS_ERROR)
<< "Channel::SendData() failed encrypt audio payload: "
<< encrypt_status;
return -1;
}
@ -543,6 +545,7 @@ int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
<< "A frame encryptor is required but one is not set.";
return -1;
}
}
// Push data from ACM to RTP/RTCP-module to deliver audio frame for
// packetization.