Re: [Alsa-user] Any way to count samples written out to the ADC?
Brought to you by:
perex
From: James Courtier-D. <jam...@gm...> - 2008-05-28 16:04:13
|
2008/5/28 Paul Adolph <pa...@gm...>: > Is there any way to divine a count of samples that leave the ALSA ring > buffer during playback? My application requires that I send a callback > when a buffer-full of data is actually played for it to do A/V sync > correctly. Right now I'm doing math to figure out the right clock > time to issue the callback, using the latency value from > snd_pcm_delay(), but this is not working very well. > > Thanks in advance. > I don't know what sort of A/V method you are using, but needing a callback for it seems wrong to me. snd_pcm_delay() gives you a way to calculate the delay between you writing samples to the buffer and them actually arriving at the speakers. You can therefore calculate the exact time a particular sample will reach the speakers, and work out the A/V sync required from that. This is how xine works to achieve A/V sync. |