1
0
mirror of https://github.com/signalwire/freeswitch.git synced 2025-03-02 17:03:52 +00:00

Merge pull request from signalwire/vad

[Core] VAD: Add a math sanity check to the switch_vad_process
This commit is contained in:
Andrey Volk 2024-05-19 21:40:09 +03:00 committed by GitHub
commit ee62332ced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -206,7 +206,9 @@ SWITCH_DECLARE(switch_vad_state_t) switch_vad_process(switch_vad_t *vad, int16_t
j += vad->channels; 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 #ifdef SWITCH_HAVE_FVAD
} }
#endif #endif