[alsa-devel] [RFC][PATCH] ASoC: Move symmetric rate check for substreams to hw_params
Bedia, Vaibhav
vaibhav.bedia at ti.com
Mon Mar 7 13:51:32 CET 2011
Hi Mark,
On Monday, March 07, 2011 5:39 PM, Mark Brown wrote:
> On Mon, Mar 07, 2011 at 05:26:03PM +0530, Vaibhav Bedia wrote:
>> Currently the symmetric rate check is present in the
>> snd_pcm_open() call. However this causes snd_pcm_open() to
>> fail for the 2nd substream is
>> the 2nd call to snd_pcm_open() is made before the 1st
>> substream has
>> set a non-zero rate by calling snd_pcm_hw_params().
>>
>> Fix this by moving the call to snd_pcm_apply_symmetry() to
>> soc_pcm_hw_params().
>
> This means that applications won't be constrained by the
> current settings so can't automatically choose the required
> rate. ALSA is just fundamentally racy here, if you want to
> reliably open bidirectional streams you need to serialise the
> startup of the two directions.
When a custom application is written then the race condition can be avoided.
However right now a simple test like "arecord -f dat | aplay -f dat" fails. One way to make it work
is to make sure that a call to arecord/aplay (or some dummy app which just sets some valid rate and returns)
has been made before both are invoked simultaneously.
Regards,
Vaibhav
More information about the Alsa-devel
mailing list