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 89fdb51b0b61624c9d69be7d947ea336ba3b9369..e985ee0aa394c274ffda9ffc5bcf21429ac676de 100644 |
--- a/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc |
@@ -67,7 +67,8 @@ Operations DecisionLogicNormal::GetDecisionSpecialized( |
return kNormal; |
} |
- const uint32_t five_seconds_samples = 5 * 8000 * fs_mult_; |
+ const uint32_t five_seconds_samples = |
+ static_cast<uint32_t>(5 * 8000 * fs_mult_); |
// Check if the required packet is available. |
if (target_timestamp == available_timestamp) { |
return ExpectedPacketAvailable(prev_mode, play_dtmf); |
@@ -87,10 +88,11 @@ Operations DecisionLogicNormal::CngOperation(Modes prev_mode, |
uint32_t target_timestamp, |
uint32_t available_timestamp) { |
// Signed difference between target and available timestamp. |
- int32_t timestamp_diff = (generated_noise_samples_ + target_timestamp) - |
- available_timestamp; |
- int32_t optimal_level_samp = |
- (delay_manager_->TargetLevel() * packet_length_samples_) >> 8; |
+ int32_t timestamp_diff = static_cast<int32_t>( |
+ static_cast<uint32_t>(generated_noise_samples_ + target_timestamp) - |
+ 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; |
if (excess_waiting_time_samp > optimal_level_samp / 2) { |
@@ -182,11 +184,11 @@ Operations DecisionLogicNormal::FuturePacketAvailable( |
// safety precaution), but make sure that the number of samples in buffer |
// is no higher than 4 times the optimal level. (Note that TargetLevel() |
// is in Q8.) |
- int32_t timestamp_diff = (generated_noise_samples_ + target_timestamp) - |
- available_timestamp; |
- if (timestamp_diff >= 0 || |
+ if (static_cast<uint32_t>(generated_noise_samples_ + target_timestamp) >= |
+ available_timestamp || |
cur_size_samples > |
- 4 * ((delay_manager_->TargetLevel() * packet_length_samples_) >> 8)) { |
+ ((delay_manager_->TargetLevel() * packet_length_samples_) >> 8) * |
+ 4) { |
// Time to play this new packet. |
return kNormal; |
} else { |