Use your audio timer, find out (precalculate yourself)  how many frames must pass
in one second of audio. Count your frames each second, if your video has not
reached the needed number of frames for your audio, skip to the frame that you
should be on (using your precalcualted frames value) That way, your video syncs
to your audio. It is much better to sync this way, because your audio never
stops. If your video skips 1 or 2 frames it is not noticable. But if your audio
skips 1 or 2 samples, you end up with clicking, as you discribed.

I hope this helps :-)

-Jay

> Hi folks. I know its heavily OT, but the most clued people are here ...
>
> How does one make sure sound and video keep in sync in a multimedia type
> application ?
>
> The problem is again the buffering. When recording, I have no problem, as the
> data gets readable as soon as the buffers are full enough, but when writing
> the writes will not block (as the buffers are bigger) and thus I have a
> constant delay between audio and video when playing back the stream by
> relying on the audio device to block.
>
> I tried DSP_SYNC but that of course gives an ugly clicking.
>
> The simplest way would be something like DSP_ALMOSTSYNC :-).
>
> Will I need to use timers running synchronously with the audio stuff to time
> the video ? And if so, are there timers that run in sync with the audio
> timers ? Or will I just have to use standard system timers and hope they do
> not deviate much ?
>
> CU, ANdy
>
> --
> = Andreas Beck                    |  Email :  <[EMAIL PROTECTED]> =

Reply via email to