X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2Fwebrtc%2Fmodules%2Faudio_coding%2Fneteq%2Fnormal.cc;h=46d03fb8cb7f28c057f03a4d83190105e075b1ba;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=bfde179bd173b6de48a5bd87733c13423dcbe65c;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/webrtc/modules/audio_coding/neteq/normal.cc b/src/third_party/webrtc/modules/audio_coding/neteq/normal.cc index bfde179..46d03fb 100644 --- a/src/third_party/webrtc/modules/audio_coding/neteq/normal.cc +++ b/src/third_party/webrtc/modules/audio_coding/neteq/normal.cc @@ -37,6 +37,11 @@ int Normal::Process(const int16_t* input, assert(output->Empty()); // Output should be empty at this point. + if (length % output->Channels() != 0) { + // The length does not match the number of channels. + output->Clear(); + return 0; + } output->PushBackInterleaved(input, length); int16_t* signal = &(*output)[0][0]; @@ -78,7 +83,11 @@ int Normal::Process(const int16_t* input, scaling = std::max(scaling, 0); // |scaling| should always be >= 0. int32_t energy = WebRtcSpl_DotProductWithScale(signal, signal, energy_length, scaling); - energy = energy / (energy_length >> scaling); + if ((energy_length >> scaling) > 0) { + energy = energy / (energy_length >> scaling); + } else { + energy = 0; + } int mute_factor; if ((energy != 0) &&