[alsa-devel] What does snd_pcm_delay() actually return?

Colin Guthrie gmane at colin.guthr.ie
Thu Jun 12 13:51:01 CEST 2008

Takashi Iwai wrote:
>> I think this 
>> was done due to the docs specifically say that it is the "difference 
>> between appl_ptr and hw_ptr" so it makes sense to assume this will 
>> return 0 when there is nothing waiting to be played. I would strongly 
>> recommend that you remove the implementation detail from the (supposedly 
>> high level) docs.
> Why?  I don't see your logic...

Well in the pulseaudio driver, snd_pcm_delay() will typically *not* 
return 0 because it will include e.g. network latency.

Therefore the wine code which *expects* it to return 0 (e.g. waits for 
it to return 0) does not get the relevant trigger it needs.

The fact that the implementation detail is included in the docs means 
that the belief that this function *will* return 0 in all cases when no 
samples are left to be played is totally understandable. As you and 
James have confirmed, the snd_pcm_delay() function should return details 
about the delay expected. The fact that this is the "difference
 >> between appl_ptr and hw_ptr" does not seem to be correct in all 

I'm no alsa expert so forgive me if I'm just "not getting it". :p


More information about the Alsa-devel mailing list