Subject: Re: [AVT] RTP/RTCP Timestamp and transmission time

From: Lorenzo Polidori <[email-masked]>
Date: Thu, 18 Sep 2003 12:31:18 +0200 (added by [email-masked])

Colin Perkins wrote:

>The RTP timestamp is NOT calculated from the NTP timestamp, but 
>represents a sampling of the media clock. 

Ok, thank you. But can you explain the exact meaning of the following
fragment of RFC 3550, section 6.4.1:
"Note that in most cases this timestamp [RTP timestamp of an SR-RTCP packet]
will not be equal to the RTP timestamp in any adjacent data packet. Rather,
it MUST be calculated from the corresponding NTP timestamp using the
relationship between the RTP timestamp counter and real time as maintained
by periodically checking the wallclock time at a sampling instant".

Now, I have an MPEG2 Elementary Stream (ES), stored on disk, to be
transmitted over RTP. From Elementary Stream I can get and convert MPEG time
code & temporal reference to a 90 kHz RTP timestamp, as in RFC 2250. So, I
put this RTP timestamp in RTP data packet header: this timestamp is computed
from the MPEG2 time code stored on disk, so it isn't correlated to the
system wallclock current time. If I get RTP timestamp of SR-RTCP packet
sampling the wallclock current time, what's the correlation between RTP
timestamp on RTP data packet and RTP timestamp on RTCP packet?

Best Regards
Lorenzo

/*******************************************************************\
*    Lorenzo POLIDORI
*    company:    BLT Italia srl        web:  http://www.blt.it
*    address:    via Rosselli, 91     city:  Lido di CAMAIORE
*    country:    ITALY                 zip:  55043-i
*    Tel. +39 0584 904788  Fax +39 0584 904789  e-mail: [email-masked]
\*******************************************************************/

_______________________________________________
Audio/Video Transport Working Group
[email-masked]
https://www1.ietf.org/mailman/listinfo/avt

---

From: Magnus Westerlund <[email-masked]>
Date: Thu, 18 Sep 2003 12:45:19 +0200

Hi Lorenzo,

See comments below.

> timestamp on RTP data packet and RTP timestamp on RTCP packet?

But what you do is that when you start the RTP session you sample the 
wall clock time and create an random TS for that instant. This TS and 
wall clock mapping is then set in the RTP stack to be used to calculate 
RTCP SR packets. When you start transmitting the first RTP packet you 
determine the correct TS offset at the beginning. From that point you 
can put the initial TS offset to the calculated TS from the MPEG streams 
start point.

Wall clock: 0---------10--------20--------30
TS        : x---y
+MPEG TS  :     0----------90000------1800000
=send TS  :

where X is the initial random TS. Y is the point of starting 
transmission. Y = X+ wallclock_since_start* TS_rate.

That way the timestamp in the RTCP will be synchronized with the media 
TS. For multiple different streams one must simple ensure that all TS 
are mapped in synch to the wall clock time.

cheers

Magnus Westerlund

Multimedia Technologies, Ericsson Research EAB/TVA/A
----------------------------------------------------------------------
Ericsson AB                | Phone +46 8 4048287
Torshamsgatan 23           | Fax   +46 8 7575550
S-164 80 Stockholm, Sweden | mailto: [email-masked]

---

From: Colin Perkins <[email-masked]>
Date: Thu, 18 Sep 2003 12:56:47 +0100

On Thursday, Sep 18, 2003, at 11:31 Europe/London, Lorenzo Polidori 
> by periodically checking the wallclock time at a sampling instant".

This is for the particular case of estimating the RTP timestamp value 
to include in an RTCP SR packet, if it is not possible to sample the 
RTP clock at arbitrary instants.

A system that cannot sample the RTP clock at arbitrary times, and which 
has no NTP-format clock, will have to set the RTP timestamp in an RTCP 
SR to zero. Systems that have no local clock are very rare though, so 
this should almost never be a concern.

> system wallclock current time.

You need to schedule the transmission time of the RTP packets according 
to their RTP timestamp. Since the packets are timed, there is a 
correlation with the wall-clock.

> If I get RTP timestamp of SR-RTCP packet

The RTP timestamps in data packets and in RTCP SR packets are samples of
the same conceptual clock, at the instant that packet is generated. The
wall-clock time is always correlated with the RTP timestamp, although it
is a separate clock (since the RTP timestamps are derived from the media
timing).

-- 
Colin Perkins
http://csperkins.org/