mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@114550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
19
main/rtp.c
19
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user