From 9b969e167d1f09604828981d238a8d86894b3a76 Mon Sep 17 00:00:00 2001 From: "jmarusic@webrtc.org" Date: Wed, 25 Feb 2015 11:53:13 +0000 Subject: [PATCH] AudioEncoderCopyRed: CHECK that encode call doesn't fail Call to AudioEncoder::Encode fails only if fed bad input, so instead of handling failure, we can just CHECK. There is also no need to handle case where size of encoded data is larger than allowed maximum, so we just CHECK. R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/42099005 Cr-Commit-Position: refs/heads/master@{#8504} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8504 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../audio_coding/codecs/red/audio_encoder_copy_red.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc index 5a256fbe6f..c1ffa53526 100644 --- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc +++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc @@ -61,12 +61,11 @@ bool AudioEncoderCopyRed::EncodeInternal(uint32_t rtp_timestamp, size_t max_encoded_bytes, uint8_t* encoded, EncodedInfo* info) { - if (!speech_encoder_->Encode(rtp_timestamp, audio, - static_cast(SampleRateHz() / 100), - max_encoded_bytes, encoded, info)) - return false; - if (max_encoded_bytes < info->encoded_bytes + secondary_info_.encoded_bytes) - return false; + CHECK(speech_encoder_->Encode(rtp_timestamp, audio, + static_cast(SampleRateHz() / 100), + max_encoded_bytes, encoded, info)); + CHECK_GE(max_encoded_bytes, + info->encoded_bytes + secondary_info_.encoded_bytes); CHECK(info->redundant.empty()) << "Cannot use nested redundant encoders."; if (info->encoded_bytes > 0) {