[MPlayer-dev-eng] [PATCH]: reduce vsync wait in VDPAU

Dan Oscarsson Dan.Oscarsson at tietoenator.com
Wed Feb 25 13:45:39 CET 2009


On 2009-02-25 at 13:05 +0100 Reimar Döffinger wrote:
> According to my information, you are supposed to use the timestamps
> feature of the flip queue to solve this issue. I have not yet
> investigated that though, so I do not know if it is actually appropriate
> for MPlayer.

It can probably be used in the sync-to-vsync handling i mplayer, but
will not solve this issue.

> Also frame-dropping is traditionally optional in MPlayer since some
> people are highly allergic to it.

So am I, and the way mplayer handles audio/video syncronisation gets
very difficult when video fps is near/same as screen refresh rate.
As the screen will only update frame at each vsync, if mplayer tries to
sync audio by displaying frames quicker it may try to display two frames
within one vsync interval resulting in only one being shown (the
equivalent of a frame drop). Just sync:ing frames to vsync without
dropping some frames, will result in audio getting out of sync as frame
speed and audio speed is different. My tests show that my graphic card
do not use the 1/fps vsync interval even if it is set to the same
refresh rate. So one way to solve it is to adjust speed to match the
video card's frame rate. The best way is something we could discuss
after the new version of mplayer is released.

> I changed the code so the number of output surfaces can be adjusted, but
> increasing that alone does not really seem to help any.

No, as the problem normally is that mplayer either plays the movie a
little faster or a little slower than the screen refresh rate, syncing
to vsync will require frame drop or frame add to keep audio in sync.
>From what I can see mplayer sync audio with video by changing the time
between each frame display. Unfortunately the screen will still only
display on frame each vsync if you want no tearing. When you use a 50hz
or 60hz screen refresh, mplayer have about 2 vsyncs for each video
frame, to display them on so the problem is less visible then.

   Dan





More information about the MPlayer-dev-eng mailing list