[svn-commits] branch bweschke/bug_5374 - r8254 /team/bweschke/bug_5374/apps/app_milliwatt.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Jan 18 22:46:43 MST 2006


Author: bweschke
Date: Wed Jan 18 23:46:42 2006
New Revision: 8254

URL: http://svn.digium.com/view/asterisk?rev=8254&view=rev
Log:
 Bringing appropriate app_milliwatt changes back in for timing based rtp transmission functionality


Modified:
    team/bweschke/bug_5374/apps/app_milliwatt.c

Modified: team/bweschke/bug_5374/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/bug_5374/apps/app_milliwatt.c?rev=8254&r1=8253&r2=8254&view=diff
==============================================================================
--- team/bweschke/bug_5374/apps/app_milliwatt.c (original)
+++ team/bweschke/bug_5374/apps/app_milliwatt.c Wed Jan 18 23:46:42 2006
@@ -73,13 +73,21 @@
 {
 	struct ast_frame wf;
 	unsigned char buf[AST_FRIENDLY_OFFSET + 640];
+	const int maxsamples = sizeof (buf) / sizeof(buf[0]);
 	int i, *indexp = (int *) data;
 
-	if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
+	/* Instead of len, use samples, because channel.c generator_force
+	* generate(chan, tmp, 0, 160) ignores len. In any case, len is
+	* a multiple of samples, given by number of samples times bytes per
+	* sample. In the case of ulaw, len = samples. for signed linear
+	* len = 2 * samples                                                 */
+
+	if (samples > maxsamples)
 	{
-		ast_log(LOG_WARNING,"Only doing %d bytes (%d bytes requested)\n",(int)(sizeof(buf) - AST_FRIENDLY_OFFSET),len);
-		len = sizeof(buf) - AST_FRIENDLY_OFFSET;
+		ast_log(LOG_WARNING,"Only doing %d samples (%d requested)\n", maxsamples,samples);
+		samples = maxsamples;
 	}
+	len = samples * sizeof(buf[0]);
 
 	wf.frametype = AST_FRAME_VOICE;
 	wf.subclass = AST_FORMAT_ULAW;



More information about the svn-commits mailing list