From: Andre Noll Date: Thu, 31 Dec 2009 15:13:53 +0000 (+0100) Subject: alsa: Close writer in post_select() on errors/eof. X-Git-Tag: v0.4.2~228 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=90d6896ed55f98ba3c9710287c8345cd09c73ace;p=paraslash.git alsa: Close writer in post_select() on errors/eof. --- diff --git a/alsa_write.c b/alsa_write.c index f8c192b7..c7b09f3b 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -315,6 +315,19 @@ static int alsa_write_post_select(__a_unused struct sched *s, return -E_ALSA_WRITE; } +static void alsa_close(struct writer_node *wn) +{ + struct private_alsa_write_data *pad = wn->private_data; + PARA_INFO_LOG("closing writer node %p\n", wn); + + if (pad->handle) { + snd_pcm_drain(pad->handle); + snd_pcm_close(pad->handle); + snd_config_update_free_global(); + } + free(pad); +} + static void alsa_write_post_select_btr(__a_unused struct sched *s, struct task *t) { @@ -372,24 +385,12 @@ again: ret = -E_ALSA_WRITE; err: assert(ret < 0); + alsa_close(wn); btr_del_node(wn->btrn); wn->btrn = NULL; t->error = ret; } -static void alsa_close(struct writer_node *wn) -{ - struct private_alsa_write_data *pad = wn->private_data; - PARA_INFO_LOG("closing writer node %p\n", wn); - - if (pad->handle) { - snd_pcm_drain(pad->handle); - snd_pcm_close(pad->handle); - snd_config_update_free_global(); - } - free(pad); -} - __malloc static void *alsa_parse_config(const char *options) { int ret;