Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Softdevice + EPIA-M / Sound resampling



On Sat, 31 Jan 2004, Colin Paton wrote:

> I have glued some CLE266 hardware mpeg2 decoding code into softdevice. I've
> now got this working with my Nehemiah M10000 and CVS DirectFB. Video is
> working well - smooth pictures on the display.

Oh, great news! As you might have noticed, i have exactly the same setup..
I would be very interested in trying your version of softdevice!

> However, the sound is still a bit iffy and AV sync isn't perfect. I suspect
> that the sound card (I'm using ALSA) isn't quite playing back at the same
> rate as the video.

Yes.

Normal mpeg file playing has only one timing problem; audio vs. video
sync. But in DVB reception, you must keep both audio and video synced to
the DVB stream, so it's quite complex.. Even very small differences in
frequencies will cause a problem after you have watched the same stream
long enough.

> I wait for the vertical blanking pulse before flipping the video
> framebuffer. This works well - get smooth pictures, but causes problems with
> the sound.

This is fine, that's how it must be done to get smooth video.

> I would therefore like to change the following:
> - Make video the primary sync source, and match audio to video.
> - Resample the audio in order to alter the frame rate slightly if necessary.
> This should hopefully avoid the gaps and clicks that I've been experiencing.

Hmm, no.

In order to get proper video<->DVB sync, you must have a method to alter
video playback speed. Easiest way is to conditionally skip or "double"
frames if the time difference becomes too big (over 1/50 = 20ms). I think
gfx card output is nearly accurate 50Hz, so this would probably mean only
a few skipped frame per hour, which is totally acceptable.

Audio<->DVB sync is much more critical.. _IF_ analog audio output is used,
you can simply adjust the playback frequency.. Like 47999Hz instead of
48000Hz. Just calculate the audio timing error, and adjust the
frequency.. After a while, the frequency will settle to some value like
47986Hz, and doesn't need big changes.

However, some people (like me) want s/pdif output, i'm not sure if that
can be synced the same way.. Perhaps it can? Anyway, analog output would
be a good start.. :)

I think softdevice already does audio<->video sync using frame
skipping/doubling. So, if you manage to keep audio<->DVB sync correct,
video should be in sync automatically too..

--
Teemu
http://zuik.org/



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index