summaryrefslogtreecommitdiff
path: root/rtp.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-05-31 16:56:50 +0000
committerRussell Bryant <russell@russellbryant.com>2006-05-31 16:56:50 +0000
commitbb7dd96cfeebec49a6adbed0c44ef92896fca2c1 (patch)
tree24a5e287490aa56d6fad0961d8832f1ba7eea1fd /rtp.c
parent503486e99d5bd1eb6ace4f62b3d6f4488b97b323 (diff)
Add support for using a jitterbuffer for RTP on bridged calls. This includes
a new implementation of a fixed size jitterbuffer, as well as support for the existing adaptive jitterbuffer implementation. (issue #3854, Slav Klenov) Thank you very much to Slav Klenov of Securax and all of the people involved in the testing of this feature for all of your hard work! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rtp.c')
-rw-r--r--rtp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/rtp.c b/rtp.c
index bfb226203..210ed5861 100644
--- a/rtp.c
+++ b/rtp.c
@@ -696,7 +696,6 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
int padding;
int mark;
int ext;
- int x;
char iabuf[INET_ADDRSTRLEN];
unsigned int ssrc;
unsigned int timestamp;
@@ -835,17 +834,6 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
if (!rtp->lastrxts)
rtp->lastrxts = timestamp;
- if (rtp->rxseqno) {
- for (x=rtp->rxseqno + 1; x < seqno; x++) {
- /* Queue empty frames */
- rtp->f.mallocd = 0;
- rtp->f.datalen = 0;
- rtp->f.data = NULL;
- rtp->f.offset = 0;
- rtp->f.samples = 0;
- rtp->f.src = "RTPMissedFrame";
- }
- }
rtp->rxseqno = seqno;
if (rtp->dtmfcount) {
@@ -877,6 +865,11 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
if (rtp->f.subclass == AST_FORMAT_SLINEAR)
ast_frame_byteswap_be(&rtp->f);
calc_rxstamp(&rtp->f.delivery, rtp, timestamp, mark);
+ /* Add timing data to let ast_generic_bridge() put the frame into a jitterbuf */
+ rtp->f.has_timing_info = 1;
+ rtp->f.ts = timestamp / 8;
+ rtp->f.len = rtp->f.samples / 8;
+ rtp->f.seqno = seqno;
} else {
/* Video -- samples is # of samples vs. 90000 */
if (!rtp->lastividtimestamp)
@@ -1701,6 +1694,9 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
if (rtp->lastts > rtp->lastdigitts)
rtp->lastdigitts = rtp->lastts;
+ if (f->has_timing_info)
+ rtp->lastts = f->ts * 8;
+
/* Get a pointer to the header */
rtpheader = (unsigned char *)(f->data - hdrlen);