[MPlayer-dev-eng] PTS system broken..
Arpi
arpi at thot.banki.hu
Thu Feb 28 23:35:39 CET 2002
Hi,
> Okay, so I've been spending a fair amount of time tracking this down, and
> basically the pts system cannot ever work reliably. This is why.
>
> It uses floating point numbers as counters and relies on them being accurate
> .
false.
yes, it uses floats for some things. but it DOES NOT relies on their
accurate values. it just uses those sh_*->timer floats to get audio and
video controlled. they don't affect a-v sync. the PTS values
(d_(audio|video)->pts) will affect a-v sync, but they are generated by
demuxers from integer numbers (file position or frame count divided by
(frame|sample|bit)rate). it's fact. believe me. i made it, i know it.
> Floating point numbers by design are not accurate, they cannot be due to the
> bits available.
>
> If you look at this expression:
>
> 8.52 - 8.48
>
> The output is not .40, but really .40001
i know this issue... but it does not affects mplayer's or mencoder's a-v
sync.
the floats aren't increased by constant values for long time, to accumlate
errrors. they are temporary valiables, and they are accurate enough (8
digits) to have xxxxx.xxx at ms resolution up to many*10 hours.
> So what happens is the duplicate code goes something like, "hey as long as
> there is a difference, duplicate a frame". So it checks the difference
> (.40001 - .40) and behold, there is one. but in reality, there isnt. So a
> duplicate frame is (incorrectly) inserted.
nope.
there are limits to be beaten, and float errors never will even be close to
this limit. currently the limit is 2 frame times, but float value never will
reach error 0.08...
> I imagine much the same thing is happening in the skip code, but so far it
> looks convoluted, so I havent been able to track down exactly whats happenin
> g
> there.
>
> The moral is, all these counter and synchronization routines should be doing
> sync based on long long's and integer counts, not floating point numbers..
they are done with integers. the float values are just temporary numbers and
never will affect a-c sync or frame drop/skip.
> Arpi?
A'rpi / Astral & ESP-team
--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu
More information about the MPlayer-dev-eng
mailing list