[asterisk-commits] russell: branch russell/jack r96443 - /team/russell/jack/apps/app_jack.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 3 18:38:40 CST 2008


Author: russell
Date: Thu Jan  3 18:38:40 2008
New Revision: 96443

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96443
Log:
Account for the fact that resample_process() will not always output as many
samples as you provide as input

Modified:
    team/russell/jack/apps/app_jack.c

Modified: team/russell/jack/apps/app_jack.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/apps/app_jack.c?view=diff&rev=96443&r1=96442&r2=96443
==============================================================================
--- team/russell/jack/apps/app_jack.c (original)
+++ team/russell/jack/apps/app_jack.c Thu Jan  3 18:38:40 2008
@@ -189,6 +189,7 @@
 	float *in_buf = buf;
 	size_t res;
 	int i;
+	size_t write_len = sizeof(s_buf);
 
 	if (jack_data->input_resampler) {
 		int total_in_buf_used = 0;
@@ -222,6 +223,8 @@
 
 		for (i = 0; i < total_out_buf_used; i++)
 			s_buf[i] = f_buf[i] * (SHRT_MAX / 1.0);
+		
+		write_len = total_out_buf_used * sizeof(int16_t);
 	} else {
 		/* No resampling needed */
 
@@ -229,8 +232,8 @@
 			s_buf[i] = in_buf[i] * (SHRT_MAX / 1.0);
 	}
 
-	res = jack_ringbuffer_write(jack_data->input_rb, (const char *) s_buf, sizeof(s_buf));
-	if (res != sizeof(s_buf)) {
+	res = jack_ringbuffer_write(jack_data->input_rb, (const char *) s_buf, write_len);
+	if (res != write_len) {
 		ast_log(LOG_WARNING, "Tried to write %d bytes to the ringbuffer, but only wrote %d\n",
 			(int) sizeof(s_buf), (int) res);
 	}




More information about the asterisk-commits mailing list