CRAS: alsa_plugin: support drain behavior and fix deadlock

Drain is not implemented for ALSA ioplug prior to alsa-lib 1.1.6.
Start from 1.1.6, drain behavior has fulfilled by alsa-lib commit
"ce2095c4 pcm: ioplug: Implement proper drain behavior".
This change supports drain behavior (from alsa_plugin's point of view)
and also fixes a deadlock problem from previous implementation.

BUG=b:110190775
TEST=sox -b 16 -r 48000 -c 2 -n -t alsa default synth 3 sine 1000 sine 1000;
cras_test_client --loopback_f xxx.raw; use audacity to check xxx.raw's
integrity

Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org>
Change-Id: I81bda34057b38cbbf0caf0c776e7b274a3d8c360
Reviewed-on: https://chromium-review.googlesource.com/1124060
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
1 file changed