From 3bca9410f4820b0bc88727bc0227505e10639d06 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 9 Jul 2008 22:39:48 +0000 Subject: [PATCH] report based on the codec we actually set. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8972 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core_codec.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 44d62596c7..1bdc19bbe1 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -76,16 +76,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->actual_samples_per_second); - if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", codec->implementation->samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", session->read_codec->implementation->iananame); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_codec->implementation->actual_samples_per_second); + if (session->read_codec->implementation->actual_samples_per_second != session->read_codec->implementation->samples_per_second) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_codec->implementation->samples_per_second); } switch_event_fire(&event); } - switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame); - switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second); + switch_channel_set_variable(channel, "read_codec", session->read_codec->implementation->iananame); + switch_snprintf(tmp, sizeof(tmp), "%d", session->read_codec->implementation->actual_samples_per_second); switch_channel_set_variable(channel, "read_rate", tmp); @@ -140,17 +140,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_ if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(session->channel, event); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second); - if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", session->write_codec->implementation->iananame); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", session->write_codec->implementation->actual_samples_per_second); + if (session->write_codec->implementation->actual_samples_per_second != session->write_codec->implementation->samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", - codec->implementation->actual_samples_per_second); + session->write_codec->implementation->actual_samples_per_second); } switch_event_fire(&event); } - switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame); - switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second); + switch_channel_set_variable(channel, "write_codec", session->write_codec->implementation->iananame); + switch_snprintf(tmp, sizeof(tmp), "%d", session->write_codec->implementation->actual_samples_per_second); switch_channel_set_variable(channel, "write_rate", tmp); return SWITCH_STATUS_SUCCESS;