On Tue, Aug 21, 2001 at 03:16:48PM +0200, Hanno Foest wrote:
> On Tuesday, Aug 21 2001 at 14:55:31 +0200, Peter Surda wrote:
> > I got fed up with the syncing problems, so I'm taking a look at the
> > source.  I think I am a little closer to the source of the problem. In
> > lib/aviplay/aviplay.cpp, the getVideoAsync function returns invalid
> > replies. I see/hear that video is obviously ahead of audio, the difference
> > grows, but getVideoAsync returns values around 0.
> I think I had the same problem... what kind of sound card do you use?
EssMaestro 2E

> aviplay syncs to real time, and when your sound card has a slightly
> different sampling frequency than its driver thinks it has, the sound
> invariably drifts out of sync.
According to my tests, yes, you are right. I seeked a video to 144th second,
then played it from beginning and paused very near the video position. It
showed 144th second too, and according to system clock, 144 seconds have
passed.

Note to developers (Zdenek baaaaad :-)) If you read Linux Audio Quality Howto,
you'll read that, except for expensive professional cards, the frequency of
the card's clock varies very much. This is caused by the fact that the card's
crystal can't sync to any outer clocks. This also means that if you
simultaneously play sounds with 2 sound cards, they will drift out of sync.

Therefore, syncing audio to realtime is WRONG, because in most case it will
produce crap.

As fluentness of audio output is important, I only see 2 possibitlities:
resample audio to match soundcards clock, or sync to card's clock. I'd go for
the second one and will post a patch soon.

> Hanno
Bye,

Peter Surda (Shurdeek) <[EMAIL PROTECTED]>, ICQ 10236103, +436505122023

--
gawk; grep; touch; unzip; touch; gasp; finger; gasp; mount; fsck;\
more; yes; gasp; umount; make clean; make mrproper

PGP signature

Reply via email to