[mythtv] Proposal for vsync.c rewrite
Doug Larrick
doug at ties.org
Tue Jul 6 08:33:26 EDT 2004
I'm writing to the list for feedback on my plans to rewrite the current
vsync.c as a set of C++ classes, before I write any code.
The biggest problem I see with the current A/V sync methods is that they
mix two tasks:
1. video frame sync to the display device
2. video sync with audio
Here's a survey of what the existing A/V sync methods do:
* OldAVSync can sleep, or sleep as long as possible then busy-wait (if
jitter reduction is on). It warps the video display interval either a
lot or a little to gain A/V sync.
* ExAVSync uses the hardware methods (nVidia device, DRI, or OpenGL) to
find the vertical refresh. If this is unavailable it does a poorer job
of sleeping than does OldAVSync. It warps the video 1/2 frame interval
every 3 frames until back into A/V sync.
* VTAVSync uses the hardware methods and also tries to fall back to
/dev/rtc before finally reverting to sleeping. It stretches or trims
audio frames (rather than video) to achieve A/V sync, unless things are
really out of whack.
I'd like to move the entire job of video frame sync to a set of new
classes. A factory method will choose the best available subclass from
the following list:
nVidia device polling
SGI OpenGL extension
DRI
/dev/rtc - VTAVSync has this code
usleep
usleep with busy wait (ReduceJitter).
The first three are preferable since they actually sync us to the
vertical retrace. /dev/rtc is available only on Linux, and the last 2
methods are important as a fallback. There may be other methods
available on other platforms.
The A/V Sync methods are then simplified to compute & provide an
adjustment factor to the frame sync methods. In fact, at this point
OldAVSync and ExAVSync become so similar it may be worth merging them.
Thoughts?
-Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040706/767bf97a/signature.pgp
More information about the mythtv-dev
mailing list