[alsa-devel] [PATCH v4 00/15] ALSA: usb-audio: fix playback/capture concurrent usage

Eldad Zack eldad at fogrefinery.com
Sun Oct 6 22:31:05 CEST 2013


This patch series attempts to fix a long standing problem with the concurrent
usage of playback and capture on implicit feedback devices.

Now the following work properly on my system:
* Full-duplex with jack :)

* All tests I ran with my tool. Will post it in case anyone want to try it,
  it takes about 15 minutes to run all the tests.

* Starting a capture-only jackd instance, e.g.:
    jackd -n 1 -d alsa -d hw:2,0 -C
  and then playback-only:
    jackd -n 2 -d alsa -d hw:2,0 -P
  and then stop and start the playback.
  The same with playback running and restarting capture.

* Trying to start a second substream with parameter mismatch (rate or
  period bytes is all I can test with my device) will fail,
  without ill effects.

With this series applied there are now 3 usage tracking variables:
 - substream usage flag
 - endpoint param_set (to protect the parameters until the endpoint is started)
 - the existing endpoint use_count

Changes from v3:
* Added substream "used" flag, to prevent failure in some combinations of ops. (#13)
* Moved start_endpoints for capture to prepare (#14)
* Added more constraints to the endpoint_may_set_params function (#10)
* Cleanups (#12, #15)


Applies against for-next, tested on upstream 3.12-rc3 (needs Alan Stern's recent
patch "improve buffer size computations for USB PCM audio" to apply cleanly
on current mainline).

Daniel and Nikolay: if you can test again with this series I'd appreciate it.


Eldad Zack (15):
  ALSA: usb-audio: remove unused parameter from sync_ep_set_params
  ALSA: usb-audio: remove deactivate_endpoints()
  ALSA: usb-audio: prevent NULL dereference on stop trigger
  ALSA: usb-audio: don't deactivate URBs on in-use EP
  ALSA: usb-audio: void return type of snd_usb_endpoint_deactivate()
  ALSA: usb-audio: clear SUBSTREAM_FLAG_SYNC_EP_STARTED on error
  ALSA: usb-audio: correct ep use_count semantics (add set_param flag)
  ALSA: usb-audio: rename alt_idx to altsetting
  ALSA: usb-audio: conditional interface altsetting
  ALSA: usb-audio: conditional concurrent usage of endpoint
  ALSA: usb-audio: remove altset_idx from snd_usb_substream
  ALSA: usb-audio: remove unused endpoint flag EP_FLAG_ACTIVATED
  ALSA: usb-audio: clear sync subs hw_params
  ALSA: usb-audio: always wait in start_endpoints
  ALSA: usb-audio: improve logging messages

 sound/usb/card.h     |   9 ++-
 sound/usb/endpoint.c | 122 ++++++++++++++++++++---------
 sound/usb/endpoint.h |  13 +++-
 sound/usb/pcm.c      | 214 ++++++++++++++++++++++++++++++++++++---------------
 sound/usb/pcm.h      |   2 +
 sound/usb/proc.c     |   4 +-
 6 files changed, 258 insertions(+), 106 deletions(-)


More information about the Alsa-devel mailing list