diff --git a/webrtc/modules/audio_coding/neteq/time_stretch.cc b/webrtc/modules/audio_coding/neteq/time_stretch.cc index 880b1f82ea..c96d165e74 100644 --- a/webrtc/modules/audio_coding/neteq/time_stretch.cc +++ b/webrtc/modules/audio_coding/neteq/time_stretch.cc @@ -182,7 +182,8 @@ bool TimeStretch::SpeechDetection(int32_t vec1_energy, int32_t vec2_energy, // (vec1_energy + vec2_energy) / 16 <= peak_index * background_noise_energy. // The two sides of the inequality will be denoted |left_side| and // |right_side|. - int32_t left_side = (vec1_energy + vec2_energy) / 16; + int32_t left_side = rtc::saturated_cast( + (static_cast(vec1_energy) + vec2_energy) / 16); int32_t right_side; if (background_noise_.initialized()) { right_side = background_noise_.Energy(master_channel_);