[gst-devel] Clocking... synchronization...
algernon at bonehunter.rulez.org
Tue May 10 07:07:44 CEST 2005
> I have make a simple file player who use decodbin and a thread for each sink
> (audio and video). But i had some trouble with A/V sync.
> So in a first time i have fixed the clock of all element at the audio clock
> (alsaclock), and i have seen that the base_time of videosonk and audiosink
> was different (depend when the thread go to state playing).
> In second time i have fixed all the base_time to the same time (just for a
> test). But there is always a delay between audio and video. Maybe because of
> elements latencys.
> I understood well how the elements must make the synchro and for what the
> base_time is used. But, I don't understand how is used latency for
> Please help me and give me the good method for A/V sync.
When I had a similar problem, I put the threads - both audio and video -
into PAUSED state first, before changing the state of the pipeline. And
that fixed it for me. (Thanks to whoever told me this on IRC :)
My understanding of this is that the threads need a little time to
allocate resources and set themselves up, and that happens when going
from NULL to READY. This gives you the difference between the base
times. When you set them up first, and all their resources are allocated
and they are really read to play, you set them to PLAY, so their
base_time will be the same (or almost the same, and the tiny difference
won't be noticable... didn't check this, as the result was good enough
(I hope I didn't write anything remarkably stupid... if I did, someone
please correct me!)
More information about the gstreamer-devel