summaryrefslogtreecommitdiff
path: root/plugins/alsa
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-13 21:41:43 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-13 21:41:43 +0200
commit67f2946932f696af0c0cd0b41ab2300402781768 (patch)
tree44168f6ded24b58fba688760c944fd4d2e7dc46d /plugins/alsa
parent65bf9ee3e24cfe98a08956c5b9acf3bc4363f36b (diff)
claim-fix to alsa blocking streamer thread
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 59de8d2b..77a7a42a 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -496,12 +496,20 @@ palsa_thread (void *context) {
/* find out how much space is available for playback data */
snd_pcm_sframes_t frames_to_deliver = snd_pcm_avail_update (audio);
while (frames_to_deliver >= period_size) {
+ if (alsa_terminate) {
+ break;
+ }
err = 0;
char buf[period_size * 4];
int bytes_to_write = palsa_callback (buf, period_size * 4);
- if ( bytes_to_write >= 4 )
+ if ( bytes_to_write >= 4 ) {
err = snd_pcm_writei (audio, buf, snd_pcm_bytes_to_frames(audio, bytes_to_write));
+ }
+ else {
+ usleep (10000);
+ continue;
+ }
if (err < 0) {
if (err == -ESTRPIPE) {