Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/delay_manager.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/delay_manager.cc b/webrtc/modules/audio_coding/neteq/delay_manager.cc |
| index 806d02b8deb538184d542e419b49c5fec37b5da9..593249480ab06add7948ee880b8aae3162dd3f19 100644 |
| --- a/webrtc/modules/audio_coding/neteq/delay_manager.cc |
| +++ b/webrtc/modules/audio_coding/neteq/delay_manager.cc |
| @@ -15,6 +15,7 @@ |
| #include <algorithm> // max, min |
| +#include "webrtc/base/safe_conversions.h" |
| #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" |
| #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" |
| #include "webrtc/modules/include/module_common_types.h" |
| @@ -93,10 +94,11 @@ int DelayManager::Update(uint16_t sequence_number, |
| packet_len_ms = packet_len_ms_; |
| } else { |
| // Calculate timestamps per packet and derive packet length in ms. |
| - int packet_len_samp = |
| + int64_t packet_len_samp = |
| static_cast<uint32_t>(timestamp - last_timestamp_) / |
| static_cast<uint16_t>(sequence_number - last_seq_no_); |
| - packet_len_ms = (1000 * packet_len_samp) / sample_rate_hz; |
| + packet_len_ms = |
| + rtc::saturated_cast<int>(1000 * packet_len_samp / sample_rate_hz); |
|
kwiberg-webrtc
2016/02/10 15:14:21
Am I guessing right when I think that this calcula
hlundin-webrtc
2016/02/10 15:36:13
Done.
|
| } |
| if (packet_len_ms > 0) { |