[asterisk-commits] branch oej/test-this-branch r15434 -
/team/oej/test-this-branch/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Mar 27 19:04:00 MST 2006
Author: oej
Date: Mon Mar 27 20:03:59 2006
New Revision: 15434
URL: http://svn.digium.com/view/asterisk?rev=15434&view=rev
Log:
Fix app_milliwatt for the rtp timing patch
Modified:
team/oej/test-this-branch/apps/app_milliwatt.c
Modified: team/oej/test-this-branch/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_milliwatt.c?rev=15434&r1=15433&r2=15434&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_milliwatt.c (original)
+++ team/oej/test-this-branch/apps/app_milliwatt.c Mon Mar 27 20:03:59 2006
@@ -71,13 +71,20 @@
{
struct ast_frame wf;
unsigned char buf[AST_FRIENDLY_OFFSET + 640];
- int i,*indexp = (int *) data;
+ const int maxsamples = sizeof (buf) / sizeof (buf[0]);
+ int i, *indexp = (int *) data;
- if (len + AST_FRIENDLY_OFFSET > sizeof(buf))
- {
- 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;
+ /* 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 samples (%d requested)\n", maxsamples, samples);
+ samples = maxsamples;
}
+ len = samples * sizeof (buf[0]);
wf.frametype = AST_FRAME_VOICE;
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
More information about the asterisk-commits
mailing list