MT#61856 main: rtpe_config, check `0 <= silence_detect <= 100`

Check that `silence_detect` is in the range 0-100.
Also properly cast to actual `silence_detect_int` type which
is `uint32_t`.

The reason is that in the current code this can exceed `INT_MAX`
(for values near or above 50%) and also, values above 100% are not rejected.

Change-Id: Ic2359402879412926b18125e292c1969cda45203
mr26.1
Donat Zenichev 1 month ago
parent bcd92e137b
commit 0f2eaff9bb

@ -1330,9 +1330,14 @@ static void options(int *argc, char ***argv, charp_ht templates) {
rtpe_config.jb_adaptive_min, rtpe_config.jb_adaptive_max);
}
if (silence_detect > 0) {
if (silence_detect > 0 && silence_detect < 100) {
rtpe_config.silence_detect_double = silence_detect / 100.0;
rtpe_config.silence_detect_int = (int) ((silence_detect / 100.0) * UINT32_MAX);
rtpe_config.silence_detect_int = (uint32_t) ((silence_detect / 100.0) * UINT32_MAX);
}
else if (silence_detect != 0) {
/* all what's < 0 and > 100 */
ilog(LOG_WARN, "Invalid --silence-detect value given (%f), must be in range 1-100",
silence_detect);
}
parse_cn_payload(&rtpe_config.cn_payload, cn_payload, "\x20", "cn-payload");

Loading…
Cancel
Save