提交 12b69406 authored 作者: Anthony Minessale's avatar Anthony Minessale

update jb command parser

上级 cf332d7c
...@@ -1628,7 +1628,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses ...@@ -1628,7 +1628,7 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses
} }
static void check_jb(switch_core_session_t *session) static void check_jb(switch_core_session_t *session, const char *input)
{ {
const char *val; const char *val;
switch_media_handle_t *smh; switch_media_handle_t *smh;
...@@ -1644,27 +1644,38 @@ static void check_jb(switch_core_session_t *session) ...@@ -1644,27 +1644,38 @@ static void check_jb(switch_core_session_t *session)
if (!a_engine->rtp_session) return; if (!a_engine->rtp_session) return;
if ((val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
int jb_msec = atoi(val); if (!zstr(input)) {
int maxlen = 0, max_drift = 0;
char *p, *q;
const char *s; const char *s;
if (!strcasecmp(val, "pause")) { if (!strcasecmp(input, "pause")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE); switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
return; return;
} else if (!strcasecmp(val, "resume")) { } else if (!strcasecmp(input, "resume")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE); switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
return; return;
} else if (!strncasecmp(val, "debug:", 6)) { } else if (!strcasecmp(input, "stop")) {
s = val + 6; switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session);
return;
} else if (!strncasecmp(input, "debug:", 6)) {
s = input + 6;
if (s && !strcmp(s, "off")) { if (s && !strcmp(s, "off")) {
s = NULL; s = NULL;
} }
switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s); switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s);
return; return;
} }
switch_channel_set_variable(session->channel, "jitterbuffer_msec", input);
}
if ((val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) {
int jb_msec = atoi(val);
int maxlen = 0, max_drift = 0;
char *p, *q;
if ((p = strchr(val, ':'))) { if ((p = strchr(val, ':'))) {
p++; p++;
maxlen = atoi(p); maxlen = atoi(p);
...@@ -1831,7 +1842,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session ...@@ -1831,7 +1842,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
} }
} }
check_jb(session); check_jb(session, NULL);
engine->check_frames = 0; engine->check_frames = 0;
engine->last_ts = 0; engine->last_ts = 0;
...@@ -5339,7 +5350,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ...@@ -5339,7 +5350,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
} }
check_jb(session); check_jb(session, NULL);
if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) { if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) {
int v = atoi(val); int v = atoi(val);
...@@ -7703,8 +7714,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se ...@@ -7703,8 +7714,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER: case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
{ {
if (switch_rtp_ready(a_engine->rtp_session)) { if (switch_rtp_ready(a_engine->rtp_session)) {
switch_channel_set_variable(session->channel, "jitterbuffer_msec", msg->string_arg); check_jb(session, msg->string_arg);
check_jb(session);
} }
} }
break; break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论