]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
you probably think i am joking but the g722 rfc ppl need to be punished
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 19 Oct 2007 05:09:18 +0000 (05:09 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 19 Oct 2007 05:09:18 +0000 (05:09 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5990 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_conference/mod_conference.c
src/switch_core_io.c

index 1ee84dc3bcdccf8ef85fb4a0b9050ec9b83ae813..62694531e2325972e58d00f95eec9f32f8ba2e91 100644 (file)
@@ -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;
        }
index 1ab35a5af618ca99fb895dbfbcc9758e14c665f1..b1b6e2b0c0a670a6d3b368411345b44965bd13fa 100644 (file)
@@ -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;
        }