[Live-devel] Problem with fPresentationTime

Ross Finlayson finlayson at live555.com
Wed Jul 29 11:14:39 PDT 2009


>My problem is fPresentationTime; the values I hand off to Live555 on 
>the server side are not the values I get on the client side.

The presentation times that you generate at the server end *must be 
aligned with 'wall clock' time - i.e., the times that you would 
generate by calling "gettimeofday()".

>   Furthermore, the _first_ value I receive on the client side is always crazy

This is normal, and espected.  It's because the first few 
presentation times - before RTCP synchronization occurs - are just 
'guesses' made by the receiving code (based on the receiver's 'wall 
clock' and the RTP timestamp).  However, once RTCP synchronization 
occurs, all subsequent presentation times will be accurate (provided 
that the server generated its presentation times properly; see above).

This means is that a receiver should be prepared for the fact that 
the first few presentation times (until RTCP synchronization starts) 
will not be accurate.  The code, however, can check this by calling 
"RTPSource:: hasBeenSynchronizedUsingRTCP()".  If this returns False, 
then the presentation times are not accurate, and should be treated 
with 'a grain of salt'.  However, once the call to returns True, then 
the presentation times (from then on) will be accurate.


>In the server, my samples come to me timestamped with a 
>REFERENCE_TIME, which is an __int64 value with 100 nanosecond units. 
>So to convert from this to the timeval, I do the following:
>
>         // Our samples are 100 NS units.  So to get to usec, we divide by 10.
>         fDurationInMicroseconds = sample->m_duration / 10;
>         REFERENCE_TIME sampleTimeInUsec = sample->m_time / 10;
>         fPresentationTime.tv_sec = (long) sampleTimeInUsec / 1000000;
>         fPresentationTime.tv_usec = (long) sampleTimeInUsec % 1000000;
>
>...I am likely doing something wrong

Yes, you're not aligning these presentation times with 'wall clock' 
time - i.e., the time that you would get by calling "gettimeofday()".
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list