[alsa-devel] [PATCH v4 14/15] ALSA: usb-audio: always wait in start_endpoints

Eldad Zack eldad at fogrefinery.com
Mon Oct 7 21:26:57 CEST 2013



On Mon, 7 Oct 2013, Takashi Iwai wrote:

> At Sun,  6 Oct 2013 22:31:19 +0200,
> Eldad Zack wrote:
> > 
> > Start the endpoints at prepare also for capture endpoints,
> > since it might be needed to wait for the URBs to be unlinked.
> > 
> > If an implicit feedback source endpoint stops being used by its
> > sink endpoint, but immediately used as a data endpoint, usb_submit_urb
> > will return -EBUSY.
> > 
> > Merge two trigger cases since they are now the same.
> This change worries me about the timing.  This change means that the
> capture stream isn't started at the moment the trigger callback is
> called but at the next urb handling.  It means a possible regression
> in the case of realtime usage.

I'm not sure I understand. Do you mean it might cause the delay between 
capture and playback to vary at each startup?

> Is there any reason to do this except for clean up?  IOW, does this
> fix any problem by itself?

Yes, I only became aware of it since I bumped into it with my test tool.
Attached here - I hope the mailing list accepts attachments.

I reverted the patch right now (mainline rc4 + this series) and this is 
the exact sequence:
$ ./atest --device hw:2 stream --first 0x0038f0
atest v1
Testing device hw:2, rate 96000, range 38f0:0
 * Test stream, Steps:  [pcm_open] [pcm_hw_params] [pcm_prepare] [pcm_start] [waitsleep] [pcm_stop] [pcm_close]
++ Test: stream, permutation: 0x0038f0
  * [1/14] playback => pcm_open
  * [2/14] playback => pcm_hw_params
  * [3/14] playback => pcm_prepare
  * [4/14] playback => pcm_start
  * [5/14] capture => pcm_open
  * [6/14] capture => pcm_hw_params
  * [7/14] capture => pcm_prepare
  * [8/14] capture => pcm_start
  * [9/14] playback => waitsleep
  * [10/14] playback => pcm_stop
  ++ Frames [playback]: 58560
  * [11/14] playback => pcm_close
  * [12/14] capture => waitsleep
  * [13/14] capture => pcm_stop
  ++ Frames [capture]: 5760
  * [14/14] capture => pcm_close
++ permutation: 0x0038f0, runtime: 0.228940 sec
++ Test: stream, permutation: 0x003907
  * [1/14] capture => pcm_open
  * [2/14] capture => pcm_hw_params
  * [3/14] capture => pcm_prepare
  * [4/14] playback => pcm_open
  * [5/14] playback => pcm_hw_params
  * [6/14] playback => pcm_prepare
  * [7/14] playback => pcm_start
  * [8/14] playback => waitsleep
  * [9/14] capture => pcm_start
  * [10/14] playback => pcm_stop
  ++ Frames [playback]: 58560
  * [11/14] playback => pcm_close
capture_thread:209: error -32 on readi 0
 ** IO Error (capture)
++ permutation: 0x003907, runtime: 0.142909 sec
!! Test stream permutation 0x003907 failed !!

...and dmesg shows:

snd_usb_endpoint_start: cannot submit urb 0, error -16: device busy

After I removed the revert, no test fail.

Cheers,
Eldad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atest-1.tar.bz2
Type: application/x-bzip2
Size: 10559 bytes
Desc: atest-1.tar.bz2
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20131007/cf4e2522/attachment-0001.bz2>


More information about the Alsa-devel mailing list