From 42a9b8fb071c8c13dea022fbb5b5eb6f75a53aee Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 19 Oct 2007 05:09:18 +0000 Subject: [PATCH] you probably think i am joking but the g722 rfc ppl need to be punished git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5990 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_conference/mod_conference.c | 17 +++++++++++------ src/switch_core_io.c | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1ee84dc3bc..62694531e2 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -243,6 +243,7 @@ struct conference_member { switch_mutex_t *flag_mutex; switch_mutex_t *audio_in_mutex; switch_mutex_t *audio_out_mutex; + switch_codec_t *orig_read_codec; switch_codec_t read_codec; switch_codec_t write_codec; char *rec_path; @@ -1511,7 +1512,7 @@ static void conference_loop_output(conference_member_t * member) uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000; uint32_t csamples = switch_bytes_per_frame(member->conference->rate, member->conference->interval); uint32_t samples = switch_bytes_per_frame(member->conference->rate, interval); - uint32_t tsamples = switch_bytes_per_frame(read_codec->implementation->samples_per_second, interval); + uint32_t tsamples;/* = switch_bytes_per_frame(read_codec->implementation->samples_per_second, interval);*/ uint32_t low_count = 0, bytes = samples * 2; call_list_t *call_list = NULL, *cp = NULL; @@ -1520,6 +1521,9 @@ static void conference_loop_output(conference_member_t * member) assert(channel != NULL); assert(member->conference != NULL); + + tsamples = member->orig_read_codec->implementation->samples_per_frame; + if (switch_core_timer_init(&timer, member->conference->timer_name, interval, //member->conference->interval, tsamples, NULL) == SWITCH_STATUS_SUCCESS) { @@ -4198,6 +4202,7 @@ SWITCH_STANDARD_APP(conference_function) /* 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); @@ -4205,15 +4210,15 @@ SWITCH_STANDARD_APP(conference_function) if (switch_core_codec_init(&member.read_codec, "L16", NULL, - read_codec->implementation->samples_per_second, + read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", - read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); + read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", - read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); + read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); flags = 0; goto done; } @@ -4250,10 +4255,10 @@ SWITCH_STANDARD_APP(conference_function) 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", - read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); + conference->rate, read_codec->implementation->microseconds_per_frame / 1000); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", - read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000); + conference->rate, read_codec->implementation->microseconds_per_frame / 1000); flags = 0; goto codec_done2; } diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1ab35a5af6..b1b6e2b0c0 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -149,7 +149,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi goto done; } - if ((*frame)->codec->implementation->samples_per_second != session->write_codec->implementation->samples_per_second) { + if ((*frame)->codec->implementation->actual_samples_per_second != session->write_codec->implementation->actual_samples_per_second) { do_resample = 1; } @@ -431,7 +431,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess need_codec = 1; } - if (frame->codec->implementation->samples_per_second != session->read_codec->implementation->samples_per_second) { + if (frame->codec->implementation->actual_samples_per_second != session->read_codec->implementation->actual_samples_per_second) { need_codec = 1; do_resample = 1; }