Index: webrtc/modules/audio_coding/neteq/time_stretch.cc |
diff --git a/webrtc/modules/audio_coding/neteq/time_stretch.cc b/webrtc/modules/audio_coding/neteq/time_stretch.cc |
index 880b1f82ea595271ee0f92795f8a39542e5039f4..c96d165e743cc9ffec8ed013598299ef40a8c9c6 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<int32_t>( |
+ (static_cast<int64_t>(vec1_energy) + vec2_energy) / 16); |
int32_t right_side; |
if (background_noise_.initialized()) { |
right_side = background_noise_.Energy(master_channel_); |