Invalid timing breaks jitterbuffering (with proposed solution)

578 views
Skip to first unread message

damja...@gmail.com

unread,
May 15, 2008, 6:07:31 AM5/15/08
to Asterisk G.729
Hello

When asterisk transcodes from G.729 to signed linear using your codec,
and jitterbuffering is enabled in sip.conf, I get this printed out for
each frame and the sound quality is terrible:

[May 15 18:02:32] WARNING[9045]: abstract_jb.c:321 ast_jb_put: VGSM/
1/1 recieved frame with invalid timing info: has_timing_info=0, len=0,
ts=0, src=g729tolin_frameout

Patching main/channel.c to copy len, ts and seqno from the G.729 frame
to the transcoded slin one fixes the problem for me (patch below), but
it's a hack, please do that in the codec instead?

Anyway, thank you and all the best
Damjan

--- main/channel.c 2008-01-28 19:15:41.000000000 +0200
+++ main/channel.c 2008-05-17 21:41:17.000000000 +0200
@@ -2229,6 +2229,7 @@
ast_frfree(f);
f = &ast_null_frame;
} else if ((f->frametype == AST_FRAME_VOICE)) {
+ int was_g729 = 0;
if (chan->audiohooks) {
struct ast_frame *old_frame = f;
f = ast_audiohook_write_list(chan, chan->audiohooks,
AST_AUDIOHOOK_DIRECTION_READ, f);
@@ -2261,8 +2262,24 @@
}
}

- if (chan->readtrans && (f = ast_translate(chan->readtrans, f, 1))
== NULL)
- f = &ast_null_frame;
+ if (!strcmp(ast_getformatname(f->subclass), "g729"))
+ was_g729 = 1;
+
+ {
+ long __ts = f->ts;
+ long __len = f->len; // time: could be worked out
+ int __seqno = f->seqno;
+
+ if (chan->readtrans && (f = ast_translate(chan->readtrans, f,
1)) == NULL)
+ f = &ast_null_frame;
+
+ if (was_g729 && !strcmp(ast_getformatname(f->subclass), "slin"))
{
+ f->ts = __ts;
+ f->len = __len;
+ f->seqno = __seqno;
+ ast_set_flag(f, AST_FRFLAG_HAS_TIMING_INFO);
+ }
+ }

/* Run generator sitting on the line if timing device not
available
* and synchronous generation of outgoing frames is
necessary */

Arkadi Shishlov

unread,
May 15, 2008, 6:10:53 AM5/15/08
to asteri...@googlegroups.com
And Asterisk version is..?

damja...@gmail.com

unread,
May 15, 2008, 6:23:03 AM5/15/08
to Asterisk G.729


On May 15, 12:10 pm, Arkadi Shishlov <arkadi.shish...@gmail.com>
wrote:
> And Asterisk version is..?

1.4.18.1, but I think it affects all versions.

Arkadi Shishlov

unread,
May 15, 2008, 7:50:47 AM5/15/08
to asteri...@googlegroups.com
How do you explain the fact that none of Asterisk bundled codecs do the stuff you propose?

I think it does not belong to the codec, because codec doesn't know about timing, nor has the
information to influence timing in a sensible way.

What about other codecs, like ilbc? Do they also sounds terrible without the patch?
Please enable "g729 debug" that should print received frame sizes at verbosity level 3. Maybe there
are some bad interactions going on.

damja...@gmail.com

unread,
May 15, 2008, 10:13:54 AM5/15/08
to Asterisk G.729
You're right. Asterisk doesn't seem to support transcoding and
jitterbuffering on the same box. It deliberately doesn't fill in those
fields when transcoding, and only jitterbuffers after transcoding.
Guess I'll be using that patch...

Thank you for looking at it.

Reply all
Reply to author
Forward
0 new messages