Index: webrtc/modules/audio_coding/neteq/merge.cc |
diff --git a/webrtc/modules/audio_coding/neteq/merge.cc b/webrtc/modules/audio_coding/neteq/merge.cc |
index 299682f60d44b260bf5a5e99fb8eb9ff5c8cb583..d50b66588a8d2e146905ea47a83a55bb4a2ada31 100644 |
--- a/webrtc/modules/audio_coding/neteq/merge.cc |
+++ b/webrtc/modules/audio_coding/neteq/merge.cc |
@@ -16,6 +16,8 @@ |
#include <algorithm> // min, max |
#include <memory> |
+#include "webrtc/base/safe_conversions.h" |
+#include "webrtc/base/safe_minmax.h" |
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" |
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" |
#include "webrtc/modules/audio_coding/neteq/cross_correlation.h" |
@@ -209,8 +211,8 @@ size_t Merge::GetExpandedSignal(size_t* old_length, size_t* expand_period) { |
int16_t Merge::SignalScaling(const int16_t* input, size_t input_length, |
const int16_t* expanded_signal) const { |
// Adjust muting factor if new vector is more or less of the BGN energy. |
- const size_t mod_input_length = |
- std::min(static_cast<size_t>(64 * fs_mult_), input_length); |
+ const auto mod_input_length = rtc::SafeMin<size_t>( |
+ 64 * rtc::dchecked_cast<size_t>(fs_mult_), input_length); |
const int16_t expanded_max = |
WebRtcSpl_MaxAbsValueW16(expanded_signal, mod_input_length); |
int32_t factor = (expanded_max * expanded_max) / |