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..78287e2da55d8b12d070ba1ca3d659c0e863dcdd 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; |
+ int64_t excess_waiting_time_samp = |
kwiberg-webrtc
2017/05/15 09:02:45
Add const while you're at it?
ivoc
2017/05/16 13:40:28
Done.
|
+ -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::saturated_cast<size_t>(noise_fast_forward_ + |
ivoc
2017/05/12 15:00:26
Not sure if saturated_cast is the right thing to d
hlundin-webrtc
2017/05/15 08:13:45
I think you should use a dchecked_cast instead. Th
kwiberg-webrtc
2017/05/15 09:02:45
+1 for dchecked_cast
ivoc
2017/05/16 13:40:28
Done.
|
+ excess_waiting_time_samp); |
+ timestamp_diff = |
+ rtc::saturated_cast<int32_t>(timestamp_diff + excess_waiting_time_samp); |
ivoc
2017/05/12 15:00:26
Here I do think saturated_cast makes sense, since
hlundin-webrtc
2017/05/15 08:13:45
Acknowledged.
kwiberg-webrtc
2017/05/15 09:02:45
Umm... excess_waiting_time_samp == -static_cast<in
hlundin-webrtc
2017/05/15 09:48:45
But the modification of timestamp_diff is only don
kwiberg-webrtc
2017/05/15 11:39:17
Right. And you can't assign -timestamp_diff or dch
|
} |
if (timestamp_diff < 0 && prev_mode == kModeRfc3389Cng) { |