[MPlayer-dev-eng] [PATCH] float comparisons and A/V desynchronization fix (mainly with real videos)

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri May 5 10:52:01 CEST 2006


On Friday 05 May 2006 12:33, Pierre Lombard wrote:
> Hi,
>
> The culprit file is libmpdemux/video.c: because of how floats are
> encoded in computers, you may almost never compare directly floating
> points values (floats are not a totally ordered set unlike integers for
> instance).
>
> This is why most math libs have an epsilon and also why a (myfloat ==
> 0.0f) will almost always fail...
>
> FWIW, I chose epsilon to be 1.0f/1000.0f as it seems to match a 1000fps
> precision - though it should indeed be related to both compared numbers.
>
> This improves dramatically the A/V sync for some real videos I have (
> the A/V sync goes wild because of incorrect frame durations because of
> this incorrect comparison).

You mean the problem when  A/V desynchronizes at scrolling, then sync is 
gradually restored ?

> Patch attached - please test and apply (or some flavor of it as you see
> fit).

With your patch I get
"Invalid frame duration value (138378.00000000/139.05400085 
=> -138238.95312500). Defaulting to 0.04000215 sec." messages at scrolling 
of .rmvb files. No visible improvement.




More information about the MPlayer-dev-eng mailing list