mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 07:04:17 +00:00
RTP stats were not being logged. There is no JIRA on this sigh
This commit is contained in:
1 parent
442a53ae3c
commit
7a42ec06df
7 files changed
+64
-57
No files matched your search
+55
-7
@@ -884,6 +884,58 @@ SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_sessi
|
||||
|
||||
}
|
||||
|
||||
#define add_stat(_i, _s) \
|
||||
switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
|
||||
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
|
||||
switch_channel_set_variable(channel, var_name, var_val)
|
||||
|
||||
static void set_stats(switch_core_session_t *session, switch_media_type_t type, const char *prefix)
|
||||
{
|
||||
switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
char var_name[256] = "", var_val[35] = "";
|
||||
|
||||
if (stats) {
|
||||
|
||||
add_stat(stats->inbound.raw_bytes, "in_raw_bytes");
|
||||
add_stat(stats->inbound.media_bytes, "in_media_bytes");
|
||||
add_stat(stats->inbound.packet_count, "in_packet_count");
|
||||
add_stat(stats->inbound.media_packet_count, "in_media_packet_count");
|
||||
add_stat(stats->inbound.skip_packet_count, "in_skip_packet_count");
|
||||
add_stat(stats->inbound.jb_packet_count, "in_jb_packet_count");
|
||||
add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count");
|
||||
add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count");
|
||||
add_stat(stats->inbound.flush_packet_count, "in_flush_packet_count");
|
||||
add_stat(stats->inbound.largest_jb_size, "in_largest_jb_size");
|
||||
|
||||
add_stat(stats->outbound.raw_bytes, "out_raw_bytes");
|
||||
add_stat(stats->outbound.media_bytes, "out_media_bytes");
|
||||
add_stat(stats->outbound.packet_count, "out_packet_count");
|
||||
add_stat(stats->outbound.media_packet_count, "out_media_packet_count");
|
||||
add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count");
|
||||
add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count");
|
||||
add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count");
|
||||
|
||||
add_stat(stats->rtcp.packet_count, "rtcp_packet_count");
|
||||
add_stat(stats->rtcp.octet_count, "rtcp_octet_count");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
if (!session->media_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
set_stats(session, SWITCH_MEDIA_TYPE_AUDIO, "audio");
|
||||
set_stats(session, SWITCH_MEDIA_TYPE_VIDEO, "video");
|
||||
}
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||
{
|
||||
switch_media_handle_t *smh;
|
||||
@@ -894,7 +946,7 @@ SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||
if (!(smh = session->media_handle)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
|
||||
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||
|
||||
@@ -917,10 +969,10 @@ SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||
|
||||
switch_core_session_unset_read_codec(session);
|
||||
switch_core_session_unset_write_codec(session);
|
||||
|
||||
switch_core_media_deactivate_rtp(session);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3442,10 +3494,6 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
|
||||
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||
|
||||
|
||||
if (switch_rtp_ready(a_engine->rtp_session)) {
|
||||
|
||||
}
|
||||
|
||||
if (v_engine->rtp_session) {
|
||||
switch_rtp_destroy(&v_engine->rtp_session);
|
||||
} else if (v_engine->codec_params.local_sdp_port) {
|
||||
@@ -6617,7 +6665,7 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_core_media_get_stats(switch_core_ses
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (switch_rtp_ready(smh->engines[type].rtp_session)) {
|
||||
if (smh->engines[type].rtp_session) {
|
||||
return switch_rtp_get_stats(smh->engines[type].rtp_session, pool);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user