diff options
author | Max Kellermann <max@duempel.org> | 2009-02-26 19:29:06 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-26 19:29:06 +0100 |
commit | 710a61a3dc2603f4ac63915c0fcce6a278fdce4c (patch) | |
tree | ebc9985579e01d6fbc049cbf68a1a24eefef7cb9 | |
parent | 4f2ac7ec2c789f290a9563f79ddbea1faeed24c9 (diff) | |
download | mpd-710a61a3dc2603f4ac63915c0fcce6a278fdce4c.tar.gz mpd-710a61a3dc2603f4ac63915c0fcce6a278fdce4c.tar.xz mpd-710a61a3dc2603f4ac63915c0fcce6a278fdce4c.zip |
pulse: removed pa_simple!=NULL checks
The MPD core guarantees that the audio_output object is always
consistent, and our pa_simple!=NULL checks are superfluous. Also
don't manually close the device on error in pulse_play(), since the
MPD core does this automatically when the play() method returns 0.
-rw-r--r-- | src/output/pulse_plugin.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c index 7114a3adb..b8fe5ad88 100644 --- a/src/output/pulse_plugin.c +++ b/src/output/pulse_plugin.c @@ -38,7 +38,6 @@ static struct pulse_data *pulse_new_data(void) ret = g_new(struct pulse_data, 1); - ret->s = NULL; ret->server = NULL; ret->sink = NULL; @@ -138,9 +137,6 @@ static void pulse_cancel(void *data) struct pulse_data *pd = data; int error; - if (pd->s == NULL) - return; - if (pa_simple_flush(pd->s, &error) < 0) g_warning("Flush failed in PulseAudio output \"%s\": %s\n", pd->name, pa_strerror(error)); @@ -150,11 +146,8 @@ static void pulse_close(void *data) { struct pulse_data *pd = data; - if (pd->s) { - pa_simple_drain(pd->s, NULL); - pa_simple_free(pd->s); - pd->s = NULL; - } + pa_simple_drain(pd->s, NULL); + pa_simple_free(pd->s); } static size_t @@ -167,7 +160,6 @@ pulse_play(void *data, const void *chunk, size_t size) g_warning("PulseAudio output \"%s\" disconnecting due to " "write error: %s\n", pd->name, pa_strerror(error)); - pulse_close(pd); return 0; } |