[MPlayer-dev-eng] threaded cache

Dan Oscarsson Dan.Oscarsson at tieto.com
Mon Dec 5 08:55:58 CET 2011


mån 2011-11-28 klockan 19:45 +0100 skrev Reimar Döffinger:
> > From what I have seen most set clocks to use CLOCK_MONOTONIC if you want
> > to be sure it works even when clock jumps.
> 
> Does it work on BSD? Does it work with MinGW pthreads? Solaris?

No idea. You cannot get everything to work well on all plattforms.

> 
> > Though it would seldom matter
> > for mplayer as there are enough other things that can make playing
> > uneven. For example timing_sleep in mplayer.c may make wrong sleep time
> > if clock jumps.
> 
> Sleeping until the year 2100 as in my example is not just "playing
> uneven". I admit it hardly happens for normal cases, but it is still
> brittle code.

On Linux we could use futex which can do relative sleep. And we could
remove the wait on the condition variable in the other cases (which
works but will not singla cache to immediately continue).

Though, do we have to make things work correctly when system clock is
changed during play? It is very seldom anybody changes the system clock,
and when they do, they know that the clock is changed and can expect
programs to misbehave. I have not gone through all of mplayer and ffmpeg
source, but there are probably many places that do not work correctly
when system clock is changed - though they may not do drastic things
like sleeping until year 2100.

   Dan




More information about the MPlayer-dev-eng mailing list