]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
a little more
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 29 Dec 2005 05:36:23 +0000 (05:36 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 29 Dec 2005 05:36:23 +0000 (05:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@235 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/mod_rawaudio/mod_rawaudio.c

index fc5b4945b8b04a4da1254081abc566c41d443675..e81925cd19b964019df7da19b8e3f0da2c3e67c2 100644 (file)
@@ -47,10 +47,16 @@ struct raw_context {
        int enc_from;
        int enc_to;
        double enc_factor;
+       float *enc_buf;
+       int enc_buf_len;
+       int enc_buf_size;
        void *dec_resampler;
        int dec_from;
        int dec_to;
        double dec_factor;
+       float *dec_buf;
+       int dec_buf_len;
+       int dec_buf_size;
 };
 
 
@@ -106,13 +112,15 @@ static switch_status switch_raw_encode(switch_codec *codec,
           TBD Support varying number of channels
        */
 
-       if (codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
+       if (other_codec && codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
                if (!context->enc_from) {
                        printf("Activate Resample %d->%d\n", codec->implementation->samples_per_second, other_codec->implementation->samples_per_second);
                        context->enc_from = codec->implementation->samples_per_second;
                        context->enc_to = other_codec->implementation->samples_per_second;
                        context->enc_factor = ((double) context->enc_from / (double)context->enc_to);
                        context->enc_resampler = resample_open(1, context->enc_factor, context->enc_factor);
+                       context->enc_buf_size = codec->implementation->bytes_per_frame;
+                       context->enc_buf = (float *) switch_core_alloc(codec->memory_pool, context->enc_buf_size);
                }
 
                if (context->enc_from) {