[alsa-devel] Query on PCM lib: wait_for_avail() API

Sarawadi, Ravishankar c_rsaraw at quicinc.com
Mon Aug 20 19:34:26 CEST 2012


I recently started working with ALSA architecture.
I am very excited to be part of ALSA group and this is my first query as ALSA developer.

This is in regards to function wait_for_avail() defined in pcm_lib.c
If audio path is broken the wait_time inside this function is 10 seconds.
wait_time = msecs_to_jiffies(wait_time * 1000);

I have a use case where I need to force exit out of this wait when audio hardware path is broken.
Waiting for 10 seconds is too long and causing synchronization issues.

My Use-case:

1       PCM Audio playback is going on. PCM write is a blocking call. Waiting on DSP WRITE-DONE event.

2       Audio hardware path failure

3       PCM driver notified of hardware path failure.

4       Meanwhile DSP ring buffer gets full as buffers are not getting consumed.

5       Next WRITE is blocked on wait_for_avail() buffer call.

6       PCM close from driver as part process to handle audio path failure is blocked on Step 5

I am trying to figure out a way to exit out of this wait forcefully by some external trigger.
Another option is to reduce this wait time to less than 5 seconds.

Could someone please recommend the best way to handle this use case?

RaviShankar (Ravi)

More information about the Alsa-devel mailing list