alsa: add a per-stream cond and wait for a safe state before stopping.
alsa: add a per-stream cond and wait for a safe state before stopping.

also move the active stream limit check to the top of stream_init (and
separate from stream registration), since it's possible to temporarily
exceed the limit if sufficient stream_init calls happen in parallel.

fix state transition clobbering caused by wrapping stream_refill in
PROCESSING/RUNNING transition by having stream_refill return the intended
final state.

kinetiknz/cubeb,ieei/cubeb,padenot/cubeb,ieei/cubeb,padenot/cubeb,kinetiknz/cubeb,padenot/cubeb,kinetiknz/cubeb