From 710a61a3dc2603f4ac63915c0fcce6a278fdce4c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Feb 2009 19:29:06 +0100 Subject: 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. --- src/output/pulse_plugin.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/output') 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; } -- cgit v1.2.3