[asterisk-commits] russell: branch 1.6.0 r106310 - in /branches/1.6.0: ./ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 5 18:16:30 CST 2008
Author: russell
Date: Wed Mar 5 18:16:30 2008
New Revision: 106310
URL: http://svn.digium.com/view/asterisk?view=rev&rev=106310
Log:
Merged revisions 105933 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r105933 | russell | 2008-03-04 19:54:16 -0600 (Tue, 04 Mar 2008) | 13 lines
Merged revisions 105932 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r105932 | russell | 2008-03-04 19:52:18 -0600 (Tue, 04 Mar 2008) | 5 lines
Fix a bug that I just noticed in the RTP code. The calculation for setting the
len field in an ast_frame of audio was wrong when G.722 is in use. The len field
represents the number of ms of audio that the frame contains. It would have
set the value to be twice what it should be.
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/include/asterisk/frame.h
branches/1.6.0/main/rtp.c
branches/1.6.0/main/translate.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Wed Mar 5 18:16:30 2008
@@ -1,1 +1,1 @@
-/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,105840-105841,105864,105899,106036,106040,106139
+/trunk:1-105595,105675,105677,105733-105734,105773,105785,105804,105840-105841,105864,105899,105933,106036,106040,106139
Modified: branches/1.6.0/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/frame.h?view=diff&rev=106310&r1=106309&r2=106310
==============================================================================
--- branches/1.6.0/include/asterisk/frame.h (original)
+++ branches/1.6.0/include/asterisk/frame.h Wed Mar 5 18:16:30 2008
@@ -611,6 +611,17 @@
*/
int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2);
+/*!
+ * \brief Get the sample rate for a given format.
+ */
+static force_inline int ast_format_rate(int format)
+{
+ if (format == AST_FORMAT_G722 || format == AST_FORMAT_SLINEAR16)
+ return 16000;
+
+ return 8000;
+}
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Modified: branches/1.6.0/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/rtp.c?view=diff&rev=106310&r1=106309&r2=106310
==============================================================================
--- branches/1.6.0/main/rtp.c (original)
+++ branches/1.6.0/main/rtp.c Wed Mar 5 18:16:30 2008
@@ -1612,7 +1612,7 @@
/* Add timing data to let ast_generic_bridge() put the frame into a jitterbuf */
ast_set_flag(&rtp->f, AST_FRFLAG_HAS_TIMING_INFO);
rtp->f.ts = timestamp / 8;
- rtp->f.len = rtp->f.samples / 8;
+ rtp->f.len = rtp->f.samples / ( (ast_format_rate(rtp->f.subclass) == 16000) ? 16 : 8 );
} else if(rtp->f.subclass & AST_FORMAT_VIDEO_MASK) {
/* Video -- samples is # of samples vs. 90000 */
if (!rtp->lastividtimestamp)
Modified: branches/1.6.0/main/translate.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/translate.c?view=diff&rev=106310&r1=106309&r2=106310
==============================================================================
--- branches/1.6.0/main/translate.c (original)
+++ branches/1.6.0/main/translate.c Wed Mar 5 18:16:30 2008
@@ -296,14 +296,6 @@
AST_RWLIST_UNLOCK(&translators);
return head;
-}
-
-static inline int format_rate(int format)
-{
- if (format == AST_FORMAT_G722 || format == AST_FORMAT_SLINEAR16)
- return 16000;
-
- return 8000;
}
/*! \brief do the actual translation */
@@ -342,7 +334,7 @@
path->nextout = f->delivery;
}
/* Predict next incoming sample */
- path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, format_rate(f->subclass)));
+ path->nextin = ast_tvadd(path->nextin, ast_samp2tv(f->samples, ast_format_rate(f->subclass)));
}
delivery = f->delivery;
for ( ; out && p ; p = p->next) {
@@ -366,7 +358,7 @@
/* Predict next outgoing timestamp from samples in this
frame. */
- path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, format_rate(out->subclass)));
+ path->nextout = ast_tvadd(path->nextout, ast_samp2tv(out->samples, ast_format_rate(out->subclass)));
} else {
out->delivery = ast_tv(0, 0);
ast_set2_flag(out, has_timing_info, AST_FRFLAG_HAS_TIMING_INFO);
@@ -390,7 +382,7 @@
struct rusage start;
struct rusage end;
int cost;
- int out_rate = format_rate(t->dstfmt);
+ int out_rate = ast_format_rate(t->dstfmt);
if (!seconds)
seconds = 1;
More information about the asterisk-commits
mailing list