[Core] VAD: Add a math sanity check to the switch_vad_process

This commit is contained in:
Andrey Volk committed 2024-05-19 21:22:31 +03:00
1 parent f87a5eeb95
commit 85400015b7
1 file changed
+3 -1
+3 -1
View File
@@ -206,7 +206,9 @@ SWITCH_DECLARE(switch_vad_state_t) switch_vad_process(switch_vad_t *vad, int16_t
j += vad->channels;
}
score = (uint32_t) (energy / (samples / vad->divisor));
if (samples && vad->divisor && samples >= vad->divisor) {
score = (uint32_t)(energy / (samples / vad->divisor));
}
#ifdef SWITCH_HAVE_FVAD
}
#endif