[asterisk-dev] signed/unsgined problem when dealing with iax frame timestamps

Guillermo Winkler gwinkler at inconcertcc.com
Thu Apr 30 16:31:50 CDT 2009


Hi, I've this nasty problem bugging me for a few days now.

We have a case when as you can see from this log:

Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 003 Type: VOICE   Subclass: 136
   Timestamp: 4294967271ms  SCall: 00006  DCall: 14259 [192.168.20.199:4569]

The timestamp gets calculated wrong(due to a sign problem) resulting in all
sorts of audio problems on the other side(when dealing with jitter buffer
historic timestamps and you know the story).

As you can see from the following debug session:

(gdb) print p->offset
$5 = {tv_sec = 1241124137, tv_usec = 640000}
(gdb) print *delivery
$6 = {tv_sec = 1241124136, tv_usec = 386000}

There is a case when the frame (coming from a SIP carrier) gets calculated
wrong in calc_timestamp

/* If we have a time that the frame arrived, always use it to make our
timestamp */
	if (delivery && !ast_tvzero(*delivery)) {
		ms = ast_tvdiff_ms(*delivery, p->offset);

This ms doesn't get checked for < 0, resulting in the huge number returned
(calc_timestamp returns ms as an unsigned int).

I guess just checking for < 0 would fix this particular situation, but I
think it could be related to an underlying problem in the timestamp
prediction for non-audio frames(when offset gets calculated).

Let me know what do you think, and whether or not I should open a bug
@bugs.digium for this issue.

Thanks,
Guille

PD: This is the callstack for the debugging session

#0  calc_timestamp (p=0x8ac11f0, ts=0, f=0x8b1fd08) 
#1  iax2_send (pvt=0x8ac11f0, f=0x8b1fd08, ts=0, seqno=-1, now=0,
transfer=0, final=0) 
#2  iax2_write (c=0x8b25760, f=0x8b1fd08) 
#3  ast_write (chan=0x8b25760, fr=0x8b1fd08) 
#4  ast_generic_bridge (c0=0x8b16680, c1=0x8b25760, config=0x5376338,
fo=0x53762fc, rc=0x53762f8, bridge_end={tv_sec = 0, tv_usec = 0}) 
#5  ast_channel_bridge (c0=0x8b16680, c1=0x8b25760, config=0x5376338,
fo=0x53762fc, rc=0x53762f8) 
#6  ast_bridge_call (










More information about the asterisk-dev mailing list