From 5b9318c109252432f61114868a9f318e5fff693e Mon Sep 17 00:00:00 2001 From: Seven Du Date: Sat, 27 Apr 2013 06:47:06 +0800 Subject: [PATCH] FS-4990 change uuid_debug_audio to uuid_debug_media and add video params --- src/include/switch_types.h | 2 +- .../applications/mod_commands/mod_commands.c | 12 +++++----- src/mod/endpoints/mod_khomp/mod_khomp.cpp | 4 ++-- src/mod/endpoints/mod_sofia/rtp.c | 2 +- .../mod_managed/managed/swig.2010.cs | 2 +- src/mod/languages/mod_managed/managed/swig.cs | 2 +- src/switch_core_media.c | 24 ++++++++++++------- src/switch_core_session.c | 2 +- src/switch_rtp.c | 4 ++-- 9 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 99017a16b7..b45a853e65 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -930,7 +930,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 24db70ac39..7c37b5a21d 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3563,8 +3563,8 @@ SWITCH_STANDARD_API(uuid_video_refresh_function) } -#define DEBUG_AUDIO_SYNTAX " " -SWITCH_STANDARD_API(uuid_debug_audio_function) +#define DEBUG_MEDIA_SYNTAX " " +SWITCH_STANDARD_API(uuid_debug_media_function) { char *mycmd = NULL, *argv[3] = { 0 }; int argc = 0; @@ -3575,13 +3575,13 @@ SWITCH_STANDARD_API(uuid_debug_audio_function) } if (zstr(cmd) || argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { - stream->write_function(stream, "-USAGE: %s\n", DEBUG_AUDIO_SYNTAX); + stream->write_function(stream, "-USAGE: %s\n", DEBUG_MEDIA_SYNTAX); goto done; } else { switch_core_session_message_t msg = { 0 }; switch_core_session_t *lsession = NULL; - msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO; + msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA; msg.string_array_arg[0] = argv[1]; msg.string_array_arg[1] = argv[2]; msg.from = __FILE__; @@ -6034,7 +6034,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "Execute dialplan application", uuid_broadcast_function, BROADCAST_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX); - SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "Debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_debug_media", "Debug media", uuid_debug_media_function, DEBUG_MEDIA_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, " [start|stop] [] [mux]"); SWITCH_ADD_API(commands_api_interface, "uuid_display", "Update phone display", uuid_display_function, DISPLAY_SYNTAX); @@ -6176,7 +6176,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_broadcast ::console::list_uuid"); switch_console_set_complete("add uuid_buglist ::console::list_uuid"); switch_console_set_complete("add uuid_chat ::console::list_uuid"); - switch_console_set_complete("add uuid_debug_audio ::console::list_uuid"); + switch_console_set_complete("add uuid_debug_media ::console::list_uuid"); switch_console_set_complete("add uuid_deflect ::console::list_uuid"); switch_console_set_complete("add uuid_displace ::console::list_uuid"); switch_console_set_complete("add uuid_display ::console::list_uuid"); diff --git a/src/mod/endpoints/mod_khomp/mod_khomp.cpp b/src/mod/endpoints/mod_khomp/mod_khomp.cpp index 557cfb46f5..6b59220076 100644 --- a/src/mod/endpoints/mod_khomp/mod_khomp.cpp +++ b/src/mod/endpoints/mod_khomp/mod_khomp.cpp @@ -791,8 +791,8 @@ switch_status_t khompReceiveMessage(switch_core_session_t *session, switch_core_ case SWITCH_MESSAGE_INDICATE_SIMPLIFY: DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_SIMPLIFY")); break; - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: - DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO")); + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA")); break; case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA: DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROXY_MEDIA")); diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index 691395eedd..e4fffa6f78 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -554,7 +554,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s assert(tech_pvt != NULL); switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: { if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 77f7395802..189cb6475a 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -27308,7 +27308,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 81a9e258fc..74914ca5f5 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -27290,7 +27290,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA, SWITCH_MESSAGE_INDICATE_UUID_CHANGE, SWITCH_MESSAGE_INDICATE_SIMPLIFY, - SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO, + SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA, SWITCH_MESSAGE_INDICATE_PROXY_MEDIA, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC, SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE, diff --git a/src/switch_core_media.c b/src/switch_core_media.c index ec31e034ca..0b329f42b1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6136,7 +6136,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se } a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; - v_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; + v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO]; switch (msg->message_id) { @@ -6226,28 +6226,36 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se } } break; - case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA: { - if (switch_rtp_ready(a_engine->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { + switch_rtp_t *rtp = a_engine->rtp_session; + const char *direction = msg->string_array_arg[0]; + + if (direction && *direction == 'v') { + direction++; + rtp = v_engine->rtp_session; + } + + if (switch_rtp_ready(rtp) && !zstr(direction) && !zstr(msg->string_array_arg[1])) { switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; - int both = !strcasecmp(msg->string_array_arg[0], "both"); + int both = !strcasecmp(direction, "both"); int set = 0; - if (both || !strcasecmp(msg->string_array_arg[0], "read")) { + if (both || !strcasecmp(direction, "read")) { flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++; set++; } - if (both || !strcasecmp(msg->string_array_arg[0], "write")) { + if (both || !strcasecmp(direction, "write")) { flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++; set++; } if (set) { if (switch_true(msg->string_array_arg[1])) { - switch_rtp_set_flags(a_engine->rtp_session, flags); + switch_rtp_set_flags(rtp, flags); } else { - switch_rtp_clear_flags(a_engine->rtp_session, flags); + switch_rtp_clear_flags(rtp, flags); } } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Options\n"); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 7a16ed4574..6ca5039426 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -705,7 +705,7 @@ static const char *message_names[] = { "REQUEST_IMAGE_MEDIA", "UUID_CHANGE", "SIMPLIFY", - "DEBUG_AUDIO", + "DEBUG_MEDIA", "PROXY_MEDIA", "APPLICATION_EXEC", "APPLICATION_EXEC_COMPLETE", diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d0d10328f2..46f7cb1957 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4625,7 +4625,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(rtp_session->session), SWITCH_LOG_CONSOLE, - "R %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", + "%sR %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", switch_channel_get_name(switch_core_session_get_channel(rtp_session->session)), (long) bytes, my_host, switch_sockaddr_get_port(rtp_session->local_addr), @@ -5466,7 +5466,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(rtp_session->session), SWITCH_LOG_CONSOLE, - "W %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", + "W %s b=%4ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", switch_channel_get_name(switch_core_session_get_channel(rtp_session->session)), (long) bytes, my_host, switch_sockaddr_get_port(rtp_session->local_addr),