[asterisk-commits] branch oej/rtptiming r15433 -
/team/oej/rtptiming/apps/app_milliwatt.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Mar 27 19:02:23 MST 2006
Author: oej
Date: Mon Mar 27 20:02:22 2006
New Revision: 15433
URL: http://svn.digium.com/view/asterisk?rev=15433&view=rev
Log:
Complete the patch :-) Thanks Mike!
Modified:
team/oej/rtptiming/apps/app_milliwatt.c
Modified: team/oej/rtptiming/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtptiming/apps/app_milliwatt.c?rev=15433&r1=15432&r2=15433&view=diff
==============================================================================
--- team/oej/rtptiming/apps/app_milliwatt.c (original)
+++ team/oej/rtptiming/apps/app_milliwatt.c Mon Mar 27 20:02:22 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