FS-7501: add video jitterbuffer debug controls

This commit is contained in:
Anthony Minessale 2015-01-16 18:14:19 -06:00 committed by Michael Jerris
parent ac2e1b692e
commit 81887e9bfc
2 changed files with 45 additions and 24 deletions

View File

@ -1692,7 +1692,7 @@ 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;
switch_rtp_engine_t *a_engine; switch_rtp_engine_t *a_engine = NULL, *v_engine = NULL;
switch_assert(session); switch_assert(session);
@ -1701,32 +1701,44 @@ static void check_jb(switch_core_session_t *session, const char *input)
} }
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
if (!a_engine->rtp_session) return;
if (!zstr(input)) { if (!zstr(input)) {
const char *s; const char *s;
if (a_engine->rtp_session) {
if (!strcasecmp(input, "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(input, "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 (!strcasecmp(input, "stop")) { } else if (!strcasecmp(input, "stop")) {
switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session); switch_rtp_deactivate_jitter_buffer(a_engine->rtp_session);
return; return;
} else if (!strncasecmp(input, "debug:", 6)) { } else if (!strncasecmp(input, "debug:", 6)) {
s = input + 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);
return;
} }
switch_rtp_debug_jitter_buffer(a_engine->rtp_session, s);
return;
}
switch_channel_set_variable(session->channel, "jitterbuffer_msec", input); switch_channel_set_variable(session->channel, "jitterbuffer_msec", input);
}
if (v_engine->rtp_session) {
if (!strncasecmp(input, "vdebug:", 7)) {
s = input + 7;
if (s && !strcmp(s, "off")) {
s = NULL;
}
switch_rtp_debug_jitter_buffer(v_engine->rtp_session, s);
return;
}
}
} }

View File

@ -3807,12 +3807,21 @@ static void jb_logger(const char *file, const char *func, int line, int level, c
SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name) SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name)
{ {
if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) { if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
stfu_n_debug(rtp_session->jb, name); if (rtp_session->jb) {
stfu_global_set_logger(jb_logger); stfu_n_debug(rtp_session->jb, name);
stfu_global_set_logger(jb_logger);
} else if (rtp_session->vb) {
int x = 0;
if (name) x = atoi(name);
if (x < 0) x = 0;
switch_vb_debug_level(rtp_session->vb, x);
}
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }