[Live-devel] Clock drift compensation
Ross Finlayson
finlayson at live555.com
Mon Dec 23 18:42:38 PST 2013
> when using live555 as a server, and vlc as a client (so using live555 as
> well) over long periods of time, with a server which is not running ntp,
> I observed the following phenomenon: depending on which clock (the
> server's or the client's) is running faster, either vlc stops or it
> plays images with a big latencies, like 10 seconds.
>
>> From what I understand of live555 code, the presentation time output by
> live555 on the client side, is essentially a server clock timestamp
That's correct.
> and
> I believe the phenomenon observed with vlc is due to the drift between
> the server clock and the client clock.
Perhaps, but it's something that you should be able to figure out for sure (see below); not just "believe".
> From what I understand of RTP/RTCP, I believe this drift could be
> compensated by comparing the NTP timestamp in RTCP sender reports, with
> the actual client time when the RTCP sender report is received,
> potentially averaging over a few reports to mitigate network jitter.
No, although you're sort of on the right track (because the RTCP "SR" arrival times can be used to compute the network 'jitter' (see RFC 3550) - and FYI in LIVE555 this jitter computation is made available to clients via the "RTPReceptionStats" database).
The way for a client to detect (and compensate for) the drift between the server and client clocks is to monitor the size of the client's playout buffer.
If the playout buffer keeps increasing over time, then the server's clock is faster than the client's. The client can compensate for this by playing out frames faster, or perhaps by dropping frames occasionally.
If the playout buffer keeps emptying - despite starting at a reasonably large level (to allow for network jitter) - then the server's clock is slower than the client's. The client can compensate this for playing out frames slower, or perhaps by duplicating frames occasionally.
> Now, the question is: what is the best place to implement this? In the application?
Yes - in the media player application (in particular, by monitoring its playout buffer). But do you really want to bother with this? VLC is only one of the many media players out there (and you've already dealt with their developers :-). I thought your project was to develop a server?
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20131224/37ea2cf5/attachment.html>
More information about the live-devel
mailing list