提交 20da5525 authored 作者: Travis Cross's avatar Travis Cross

Preserve value of send_silence_when_idle if possible

In commit 55d01d3d we set
send_silence_when_idle to -1 rather than 400 when SRTP is engaged.
But this left no way to enable white noise silence when desired.

When SRTP is engaged we can't simply not send RTP because it breaks
too many devices.  So we need to prevent send_silence_when_idle from
being unset or being set to zero.  This change allows it to be set to
other values so as to feed white noise rather than all zeros into the
codec.
上级 11ca1a2b
......@@ -3011,6 +3011,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
switch_event_t *fsevent = NULL;
int idx = 0;
const char *var;
if (direction >= SWITCH_RTP_CRYPTO_MAX || keylen > SWITCH_RTP_MAX_CRYPTO_LEN) {
return SWITCH_STATUS_FALSE;
......@@ -3040,7 +3041,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
memset(policy, 0, sizeof(*policy));
switch_channel_set_variable(channel, "send_silence_when_idle", "-1");
/* many devices can't handle gaps in SRTP streams */
if (!(var = switch_channel_get_variable(channel, "send_silence_when_idle"))
|| !(atoi(var))) {
switch_channel_set_variable(channel, "send_silence_when_idle", "-1");
}
switch (crypto_key->type) {
case AES_CM_128_HMAC_SHA1_80:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论