From 3bb90ac41c5a6d0cf446cb43afc6b78a077ee036 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 6 Oct 2010 15:16:09 -0500 Subject: [PATCH] fix some edge cases --- .../applications/mod_conference/mod_conference.c | 15 ++++++++++++--- src/switch_core_codec.c | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e1570a7af5..ed62da107b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2580,7 +2580,10 @@ static void conference_loop_output(conference_member_t *member) if (member->fnode) { member_add_file_data(member, write_frame.data, write_frame.datalen); } - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } @@ -2590,7 +2593,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; memset(write_frame.data, 255, write_frame.datalen); member_add_file_data(member, write_frame.data, write_frame.datalen); - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } else if (!switch_test_flag(member->conference, CFLAG_WASTE_BANDWIDTH)) { if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) { if (member->conference->comfort_noise_level) { @@ -2603,7 +2609,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; write_frame.timestamp = timer.samplecount; - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index d45d73ed76..9b607ea873 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -137,9 +137,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s memset(&session->read_impl, 0, sizeof(session->read_impl)); } old->next = NULL; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n", switch_channel_get_name(session->channel), - session->read_codec->implementation->iananame, session->read_codec->implementation->ianacode); + session->read_impl.iananame ? session->read_impl.iananame : "N/A", session->read_impl.ianacode); + } else if (session->real_read_codec) { session->read_codec = session->real_read_codec;