}
-static void check_jb(switch_core_session_t *session)
+static void check_jb(switch_core_session_t *session, const char *input)
{
const char *val;
switch_media_handle_t *smh;
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);
- int maxlen = 0, max_drift = 0;
- char *p, *q;
+
+ if (!zstr(input)) {
const char *s;
-
- if (!strcasecmp(val, "pause")) {
+
+ if (!strcasecmp(input, "pause")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
return;
- } else if (!strcasecmp(val, "resume")) {
+ } else if (!strcasecmp(input, "resume")) {
switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
return;
- } else if (!strncasecmp(val, "debug:", 6)) {
- s = val + 6;
+ } else if (!strcasecmp(input, "stop")) {
+ switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session);
+ return;
+ } else if (!strncasecmp(input, "debug:", 6)) {
+ s = input + 6;
if (s && !strcmp(s, "off")) {
s = NULL;
}
switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s);
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, ':'))) {
p++;
maxlen = atoi(p);
}
}
- check_jb(session);
+ check_jb(session, NULL);
engine->check_frames = 0;
engine->last_ts = 0;
}
- check_jb(session);
+ check_jb(session, NULL);
if ((val = switch_channel_get_variable(session->channel, "rtp_timeout_sec"))) {
int v = atoi(val);
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
{
if (switch_rtp_ready(a_engine->rtp_session)) {
- switch_channel_set_variable(session->channel, "jitterbuffer_msec", msg->string_arg);
- check_jb(session);
+ check_jb(session, msg->string_arg);
}
}
break;