Index: webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
diff --git a/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc b/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
index c271bd969df2c4a5065334f2794edde776524ad7..c5f25707586c009856b598a692e944ddc551ba20 100644 |
--- a/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
@@ -97,14 +97,17 @@ Operations DecisionLogicNormal::CngOperation(Modes prev_mode, |
available_timestamp); |
int32_t optimal_level_samp = static_cast<int32_t>( |
(delay_manager_->TargetLevel() * packet_length_samples_) >> 8); |
- int32_t excess_waiting_time_samp = -timestamp_diff - optimal_level_samp; |
+ const int64_t excess_waiting_time_samp = |
+ -static_cast<int64_t>(timestamp_diff) - optimal_level_samp; |
if (excess_waiting_time_samp > optimal_level_samp / 2) { |
// The waiting time for this packet will be longer than 1.5 |
// times the wanted buffer delay. Apply fast-forward to cut the |
// waiting time down to the optimal. |
- noise_fast_forward_ += excess_waiting_time_samp; |
- timestamp_diff += excess_waiting_time_samp; |
+ noise_fast_forward_ = rtc::dchecked_cast<size_t>(noise_fast_forward_ + |
+ excess_waiting_time_samp); |
+ timestamp_diff = |
+ rtc::saturated_cast<int32_t>(timestamp_diff + excess_waiting_time_samp); |
} |
if (timestamp_diff < 0 && prev_mode == kModeRfc3389Cng) { |