Index: webrtc/modules/audio_processing/aec3/suppression_filter.cc |
diff --git a/webrtc/modules/audio_processing/aec3/suppression_filter.cc b/webrtc/modules/audio_processing/aec3/suppression_filter.cc |
index b172a1d0899264cc5e69a60c33f8c597d7262488..1121c74efed88e72e239078a6b7ad24b01162a91 100644 |
--- a/webrtc/modules/audio_processing/aec3/suppression_filter.cc |
+++ b/webrtc/modules/audio_processing/aec3/suppression_filter.cc |
@@ -16,6 +16,7 @@ |
#include <functional> |
#include <numeric> |
+#include "webrtc/base/safe_minmax.h" |
#include "webrtc/modules/audio_processing/utility/ooura_fft.h" |
namespace webrtc { |
@@ -122,7 +123,7 @@ void SuppressionFilter::ApplyGain( |
std::transform((*e)[0].begin(), (*e)[0].end(), e_extended.begin(), |
(*e)[0].begin(), std::plus<float>()); |
std::for_each((*e)[0].begin(), (*e)[0].end(), [](float& x_k) { |
- x_k = std::max(std::min(x_k, 32767.0f), -32768.0f); |
+ x_k = rtc::SafeClamp(x_k, -32768.f, 32767.f); |
}); |
std::copy(e_extended.begin() + kFftLengthBy2, e_extended.begin() + kFftLength, |
std::begin(e_output_old_[0])); |
@@ -154,7 +155,7 @@ void SuppressionFilter::ApplyGain( |
if (e->size() > 2) { |
RTC_DCHECK_EQ(3, e->size()); |
std::for_each((*e)[2].begin(), (*e)[2].end(), [&](float& a) { |
- a = std::max(std::min(a * high_bands_gain, 32767.0f), -32768.0f); |
+ a = rtc::SafeClamp(a * high_bands_gain, -32768.f, 32767.f); |
}); |
} |