[Freeswitch-svn] [commit] r7972 - in freeswitch/trunk/src: . mod/applications/mod_conference mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Thu Mar 27 16:36:04 EDT 2008
Author: anthm
Date: Thu Mar 27 16:36:03 2008
New Revision: 7972
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/switch_core_codec.c
freeswitch/trunk/src/switch_core_state_machine.c
freeswitch/trunk/src/switch_loadable_module.c
Log:
update
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Thu Mar 27 16:36:03 2008
@@ -4140,6 +4140,12 @@
conf_xml_cfg_t xml_cfg = { 0 };
switch_event_t *params = NULL;
+ /* Save the original read codec. */
+ if (!(read_codec = switch_core_session_get_read_codec(session))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n");
+ return;
+ }
+
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid arguments\n");
@@ -4376,9 +4382,7 @@
if (!switch_channel_test_flag(channel, CF_OUTBOUND))
switch_set_flag(conference, CFLAG_ANSWERED);
}
-
- /* Save the original read codec. */
- read_codec = switch_core_session_get_read_codec(session);
+
member.orig_read_codec = read_codec;
member.native_rate = read_codec->implementation->samples_per_second;
member.pool = switch_core_session_get_pool(session);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Thu Mar 27 16:36:03 2008
@@ -1043,7 +1043,6 @@
} else {
if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
-
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Thu Mar 27 16:36:03 2008
@@ -1961,6 +1961,7 @@
for (map = m->m_rtpmaps; map; map = map->rm_next) {
int32_t i;
+ uint32_t near_rate = 0;
const switch_codec_implementation_t *mimp = NULL, *near_match = NULL;
const char *rm_encoding;
@@ -2018,8 +2019,9 @@
match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
}
- if (match && (map->rm_rate == codec_rate)) {
- if (ptime && ptime * 1000 != imp->microseconds_per_frame) {
+ if (match) {
+ if ((ptime && ptime * 1000 != imp->microseconds_per_frame) || map->rm_rate != codec_rate) {
+ near_rate = map->rm_rate;
near_match = imp;
match = 0;
continue;
@@ -2036,8 +2038,8 @@
char *prefs[1];
char tmp[80];
int num;
-
- switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime);
+
+ switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
prefs[0] = tmp;
num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
@@ -2047,9 +2049,9 @@
} else {
mimp = near_match;
}
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ums\n",
- mimp->iananame, mimp->microseconds_per_frame / 1000);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
+ mimp->iananame, mimp->microseconds_per_frame / 1000, mimp->samples_per_second);
match = 1;
}
Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c (original)
+++ freeswitch/trunk/src/switch_core_codec.c Thu Mar 27 16:36:03 2008
@@ -41,6 +41,8 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
char tmp[30];
+ switch_assert(codec->implementation);
+
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);
@@ -75,6 +77,8 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
char tmp[30];
+ switch_assert(codec->implementation);
+
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);
Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c (original)
+++ freeswitch/trunk/src/switch_core_state_machine.c Thu Mar 27 16:36:03 2008
@@ -160,7 +160,10 @@
} else if (!switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) && !switch_channel_media_ready(session->channel)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Application %s Requires media! pre_answering channel %s\n",
extension->current_application->application_name, switch_channel_get_name(session->channel));
- switch_channel_pre_answer(session->channel);
+ if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Well, that didn't work very well did it? ...\n");
+ return;
+ }
}
if ((expanded =
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Thu Mar 27 16:36:03 2008
@@ -1245,7 +1245,7 @@
for (x = 0; x < preflen; x++) {
char *cur, *last = NULL, *next = NULL, *name, *p, buf[256];
- uint32_t interval = 0, rate = 0;
+ uint32_t interval = 0, rate = 8000;
switch_copy_string(buf, prefs[x], sizeof(buf));
last = name = next = cur = buf;
More information about the Freeswitch-svn
mailing list