[vlc-devel] Re: Clock synchro problems - proposed solution

Marian Durkovic md at bts.sk
Thu Nov 10 09:01:14 CET 2005

> Where I don't find your patch acceptable is that it makes assumptions about 
> the kind of streams you are receiving. For instance checking the PCR every 
> second means you don't care about low delay.

I don't think this is fully correct. The current implementation updates 
clock delta every 14-39 msec - but two freerunning clocks definitely
don't diverge that fast. If cr_average is 40 and PCRs are coming in 30 msec 
intervals, the averaging period is 1.2 seconds. If you run into sheduler 
delays (hundreds of msec) or temporary network problem, the reference clock 
gets corrupted so much, that the whole timebase gets bogus - and VLC starts 
resampling, issuing sychro warnings etc. Moreover it does not work with 
multiple PCRs in the same packet and it does not work with variable bitrate
streams - they first downsample and immediately after upsample on each bigger
bitrate change.

On the other hand, checking PCRs at larger intervals avoids the temporary
scheduling/jitter problems and is IMHO still more than adequate to
compensate clock drifts without negatively affecting the low-delay
requirements (we're speaking of e.g. 100 ppm here). If you feel
that 1 second is too much - OK, we could lower it to e.g. 500 msec, but
I think it's more apropriate to perform clock adjustments at the same interval 
for all streams (not 14 msec for one and 39 msec for another).

> And discarding PCRs which are too early or too late by 80ms is a bit extreme 
> as well. What if the server and client are really out of sync by that much 
> or more ?

This was meant as relative to 1 second interval - the clock can't drift 
80 msec in 1 second - this would be 80000 ppm. But I've not included this
in the second version of the patch, since after the rounding error was
fixed by Sigmund, it doesn't seem to be necessary anymore. 

The patch could be found in my previous email or here:


I'd suggest to actually try it...

	With kind regards,


----                                                                  ----
----   Marian Durkovic                       network  manager         ----
----                                                                  ----
----   Slovak Technical University           Tel: +421 2 524 51 301   ----
----   Computer Centre, Nam. Slobody 17      Fax: +421 2 524 94 351   ----
----   812 43 Bratislava, Slovak Republic    E-mail/sip: md at bts.sk    ----
----                                                                  ----

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html

More information about the vlc-devel mailing list