diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 21:14:55 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 21:14:55 +0000 |
commit | 9935bee8cf864b5a57787f8fd72d150ef89ce68b (patch) | |
tree | 9b131feb9104cf0ca54f6bbc52640ee0f0c1798e /main/rtp.c | |
parent | 0f572d416bc6cd1ed82cb9493cd1d2daff48667f (diff) |
I thought I was going to be able to leave 1.4 alone, but that was not the case.
I ran into some problems with G.722 in 1.4, so I have merged in all of the fixes
in this area that I have made in trunk/1.6.0, and things are happy again.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114550 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/rtp.c')
-rw-r--r-- | main/rtp.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/main/rtp.c b/main/rtp.c index 3621d3610..658bd0891 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -1313,7 +1313,7 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp) /* 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 / ( (ast_format_rate(rtp->f.subclass) == 16000) ? 16 : 8 ); + rtp->f.len = rtp->f.samples / (ast_format_rate(rtp->f.subclass) / 1000); } else { /* Video -- samples is # of samples vs. 90000 */ if (!rtp->lastividtimestamp) @@ -2795,17 +2795,28 @@ int ast_rtp_write(struct ast_rtp *rtp, struct ast_frame *_f) ast_smoother_feed(rtp->smoother, _f); } - while((f = ast_smoother_read(rtp->smoother)) && (f->data)) + while ((f = ast_smoother_read(rtp->smoother)) && (f->data)) { + if (f->subclass == AST_FORMAT_G722) { + /* G.722 is silllllllllllllly */ + f->samples /= 2; + } + ast_rtp_raw_write(rtp, f, codec); + } } else { - /* Don't buffer outgoing frames; send them one-per-packet: */ + /* Don't buffer outgoing frames; send them one-per-packet: */ if (_f->offset < hdrlen) { f = ast_frdup(_f); } else { f = _f; } - if (f->data) + if (f->data) { + if (f->subclass == AST_FORMAT_G722) { + /* G.722 is silllllllllllllly */ + f->samples /= 2; + } ast_rtp_raw_write(rtp, f, codec); + } if (f != _f) ast_frfree(f); } |