<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Re: [Live-devel] Timestamp gap in RTCP Report for MPEG1or</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE type=text/css>BLOCKQUOTE {
        PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
DL {
        PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
UL {
        PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
OL {
        PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
LI {
        PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
</STYLE>
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT face=Arial
color=#0000ff size=2></FONT> </DIV>
<DIV></DIV>
<BLOCKQUOTE cite="" type="cite"><FONT face=Arial size=-1>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>sending
REPORT<BR>fTimestampBase: 0xae0daf0d, tv: 683383.099932, RTP timestamp:
101919</FONT></BLOCKQUOTE>
<BLOCKQUOTE cite="" type="cite"><FONT face=Arial size=-1>Creating RTCP SR
packet, SSRC is 0x6da5, NTP is : tv: 683383.099932, TimeStamp is:
101919<BR>sending RTCP packet<BR> 80c80006 00006da5 83b4ebf7 199524c0
00018e1f 000000db 0003c76d 81ca0005 00006da5 010a7377 6f70742d 766f6970
00000000<BR>schedule(1.015347->683384.121916)</FONT></BLOCKQUOTE>
<BLOCKQUOTE cite="" type="cite"><FONT face=Arial size=-1>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097<BR>fTimestampBase:
0xae0daf0d, tv: 683382.201906, RTP timestamp: 21097</FONT></BLOCKQUOTE>
<BLOCKQUOTE cite="" type="cite"><FONT face=Arial size=-1>fTimestampBase:
0xae0daf0d, tv: 683382.235273, RTP timestamp: 24100<BR>fTimestampBase:
0xae0daf0d, tv: 683382.235273, RTP timestamp: 24100</FONT><BR></BLOCKQUOTE>
<BLOCKQUOTE cite="" type="cite"><FONT face=Arial size=-1>Obviously the
TimeStamp value of the RTCP SR packet should be between 21097 and
24100.</FONT></BLOCKQUOTE>
<DIV><BR></DIV>
<DIV>No - because the 'NTP' time (683383.099932) that's used for the RTCP SR
packet is not between 683382.201906 and 683382.235273. The RTP timestamp
of 101919 corresponds to the time 683383.099932.<SPAN
class=843175616-05022008><FONT face=Arial color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2>Agree</FONT> </SPAN></DIV>
<DIV><BR></DIV>
<DIV>It's perfectly OK for the NTP time that's used in a RTCP "SR" report to
differ from the presentation time used in RTP packets that bracket
it. <SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2>Agree</FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008> </SPAN>However, because the RTCP SR
'NTP' time is computed using "gettimeofday()" (i.e., 'wall clock' time), the
presentation times for your media samples (that get passed to RTP) *must* also
be aligned with 'wall clock' time.<SPAN class=843175616-05022008><FONT
face=Arial color=#0000ff size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2>Agree. But this is the problem, as I said the <FONT
color=#000000><FONT
color=#0000ff>MPEGVideoStreamFramer</FONT> </FONT><FONT
color=#0000ff>computes the TimeStamp from the Mpeg2 Stream. There is no mean
to bypass or feed the presentation times. The Presentation computing mechanism
is internal to the object and follow the Mpeg2 Video Stream. Unless I have
missing something but I use the sample application as provided with the
library.</FONT></FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT><BR></DIV>
<DIV>The timestamp generation code (for both RTP and RTCP) is
correct. <SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><SPAN class=843175616-05022008><FONT
face=Arial color=#0000ff size=2>No it is not. Well I mean the RTP timestamp.
The RTCP timestamp is correctly computed.</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><SPAN class=843175616-05022008><FONT
face=Arial color=#0000ff size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>For
the following discussion it is important that I add this information. The
Mpeg2 Video ES is an I frame only stream. </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>Thus
the Timestamp will always increment from frame to frame. When the Timestamp go
from 21097 to 24100 then a new Mpeg2 I frame begin. Since the RTCP packet
is sent near the end of the I frame with timestamp 21097 but before any packet
of I frame with timestamp 24100 has been sent then the RTCP RS timestamp
should have been somewhere between timestamp 21097 and 24100 if the RTP
timestamp would have been correctly timestamped.</FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT color=#0000ff><FONT face=Arial
size=2>Actually the RTCP is timestamped with value 101919 which is greater
than 24100 and way off. <FONT color=#0000ff> This is out of the RTP
specification to the best of my
understanding.</FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>If
you have the book of Colin Perkins : "RTP Audio and Video for the Internet"
then please turn to page 109. This will make it more clear. Of course since
the RTP packets are Mpeg2 formatted then the timestamp stay constant until the
next I frame. </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN><SPAN class=843175616-05022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>The
reason of the discrepancy is the delay introduced by the parsing of the Mpeg2
Video Stream and the reading of the raw data. This will create Timestamps that
are offset in the past.</FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV> However, for it to work correctly, you must feed it correct
presentation times.<SPAN class=843175616-05022008><FONT face=Arial
color=#0000ff size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>I
might not know the library code enough but at first glance it seems I cannot
because the mechanism is internal to the </FONT> <FONT size=2><FONT
face=Arial><FONT
color=#0000ff>MPEG1or2VideoStreamFramer/MpegVideoStreamFramer. Unless I change
the source code of the library file. </FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=843175616-05022008><FONT face=Arial color=#0000ff size=2>Guy
Bonneau</FONT></SPAN></DIV><X-SIGSEP><PRE>--
</PRE></X-SIGSEP>
<DIV><BR>Ross Finlayson<BR>Live Networks,
Inc.<BR>http://www.live555.com/</DIV></BLOCKQUOTE></BODY></HTML>