Summary:ASTERISK-12330: [patch] unwrap_timestamp() is bogus for video frames
Reporter:Peter Grayson (jpgrayson)Labels:
Date Opened:2008-07-07 14:19:50Date Closed:2008-07-08 11:37:51
Versions:Frequency of
Environment:Attachments:( 0) chan_iax2_unwrap_ts.patch
Description:In chan_iax2, unwrap_timestamp() takes the 16-bit timestamp found in the iax2 packet header and the 32-bit timestamp in the chan_iax2_pvt structure and reconstructs a full 32-bit timestamp for the incoming packet.

The problem is that this function is totally bogus for video frames. The fundamental problem is that video mini frames only have 15-bits of timestamp in the packet header, not 16-bits like voice frames.

The consequence of this is that asterisk will periodically fail to detect timestamp rollover for video frames. This results in big swaths of video packets to be thrown in the bit bucket.

unwrap_timestamp() needs to account for video frames which only have 15-bits of timestamp information.
Comments:By: Peter Grayson (jpgrayson) 2008-07-07 14:26:15

This patch reworks unwrap_timestamp() to take into account both voice and video frame types. It replaces a bunch of magic constants with const variables. Following the algebra carefully, it can be seen that this code change does not affect voice frames, it only affects video frames.

For video frames, this patch takes into account the number of bits of timestamp (15) found in the iax2 packet header. This causes asterisk to correctly detect timestamp rollover for video frames.

By: Digium Subversion (svnbot) 2008-07-08 11:37:48

Repository: asterisk
Revision: 129047

U   branches/1.4/channels/chan_iax2.c

r129047 | tilghman | 2008-07-08 11:37:47 -0500 (Tue, 08 Jul 2008) | 7 lines

Timestamp decoding for video mini-frames is bogus, because the timestamp only
includes 15 bits, unlike voice frames, which contain a 16-bit timestamp.
(closes issue ASTERISK-12330)
Reported by: jpgrayson
      chan_iax2_unwrap_ts.patch uploaded by jpgrayson (license 492)