diff --git a/src/audio/google/google_rtc_audio_processing.c b/src/audio/google/google_rtc_audio_processing.c index 28e36f3eb430..ddacf9a25b2a 100644 --- a/src/audio/google/google_rtc_audio_processing.c +++ b/src/audio/google/google_rtc_audio_processing.c @@ -141,7 +141,8 @@ static ALWAYS_INLINE float s32_to_float(const char *ptr) static ALWAYS_INLINE void float_to_s32(float x, char *dst) { - *(int32_t *)dst = (int16_t)clamp_rescale(-(float)INT_MIN, x); + /* in float, 1.0f - 1.0f / 2^31 rounds to 1.0f, so full scale reaches 2^31 */ + *(int32_t *)dst = sat_int32((int64_t)clamp_rescale(-(float)INT_MIN, x)); } static ALWAYS_INLINE void source_to_float(struct sof_source *src, float **dst_bufs,