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
This commit is contained in:
jmarusic@webrtc.org 2015-02-25 11:53:13 +00:00
parent 749c60217d
commit 9b969e167d

View File

@ -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<size_t>(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<size_t>(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) {