[PATCH] Fix Speex Resampler multi channel mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

this patch fixes the Speex resampler multi channel mode (e.g. stereo) by fixing the sample count calculation (which didn't resect the current channel count).

Regards
Tobias


--- pjmedia/src/pjmedia/resample_speex.c	2011-05-05 08:14:19.000000000 +0200
+++ pjmedia/src/pjmedia/resample_speex.c	2016-12-15 09:47:52.177128884 +0100
@@ -50,6 +50,7 @@
     pjmedia_resample *resample;
     int quality;
     int err;
+    unsigned samples_per_frame_per_channel;

     PJ_ASSERT_RETURN(pool && p_resample && rate_in &&
 		     rate_out && samples_per_frame, PJ_EINVAL);
@@ -66,8 +67,9 @@
 	quality = 3;
     }

-    resample->in_samples_per_frame = samples_per_frame;
-    resample->out_samples_per_frame = rate_out / (rate_in / samples_per_frame);
+    samples_per_frame_per_channel = samples_per_frame / channel_count;
+    resample->in_samples_per_frame = samples_per_frame_per_channel;
+    resample->out_samples_per_frame = rate_out / (rate_in / samples_per_frame_per_channel);
     resample->state = speex_resampler_init(channel_count,  rate_in, rate_out,
                                            quality, &err);
     if (resample->state == NULL || err != RESAMPLER_ERR_SUCCESS)
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux