From 44e474f76d5fbcf94080e4fa0b95bf0dbd25edd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 4 Apr 2010 21:18:04 +0200 Subject: [PATCH] alsa: Ignore errors when unpreparing or closing the device Errors could happen here when the device was removed already or when something is broken anyway. If errors happen here and they're propagated, the element can't shutdown cleanly. Fixes bug #614545. --- ext/alsa/gstalsasink.c | 31 +++---------------------------- ext/alsa/gstalsasrc.c | 29 +++-------------------------- 2 files changed, 6 insertions(+), 54 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index c20688b..b1ef741 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -764,52 +764,27 @@ static gboolean gst_alsasink_unprepare (GstAudioSink * asink) { GstAlsaSink *alsa; - gint err; alsa = GST_ALSA_SINK (asink); - CHECK (snd_pcm_drop (alsa->handle), drop); - - CHECK (snd_pcm_hw_free (alsa->handle), hw_free); + snd_pcm_drop (alsa->handle); + snd_pcm_hw_free (alsa->handle); return TRUE; - - /* ERRORS */ -drop: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL), - ("Could not drop samples: %s", snd_strerror (err))); - return FALSE; - } -hw_free: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL), - ("Could not free hw params: %s", snd_strerror (err))); - return FALSE; - } } static gboolean gst_alsasink_close (GstAudioSink * asink) { GstAlsaSink *alsa = GST_ALSA_SINK (asink); - gint err; if (alsa->handle) { - CHECK (snd_pcm_close (alsa->handle), close_error); + snd_pcm_close (alsa->handle); alsa->handle = NULL; } gst_caps_replace (&alsa->cached_caps, NULL); return TRUE; - - /* ERRORS */ -close_error: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, CLOSE, (NULL), - ("Playback close error: %s", snd_strerror (err))); - return FALSE; - } } diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index b6a4e1b..4789771 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -693,37 +693,14 @@ static gboolean gst_alsasrc_unprepare (GstAudioSrc * asrc) { GstAlsaSrc *alsa; - gint err; alsa = GST_ALSA_SRC (asrc); - CHECK (snd_pcm_drop (alsa->handle), drop); - - CHECK (snd_pcm_hw_free (alsa->handle), hw_free); - - CHECK (snd_pcm_nonblock (alsa->handle, 1), non_block); + snd_pcm_drop (alsa->handle); + snd_pcm_hw_free (alsa->handle); + snd_pcm_nonblock (alsa->handle, 1); return TRUE; - - /* ERRORS */ -drop: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL), - ("Could not drop samples: %s", snd_strerror (err))); - return FALSE; - } -hw_free: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL), - ("Could not free hw params: %s", snd_strerror (err))); - return FALSE; - } -non_block: - { - GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL), - ("Could not set device to nonblocking: %s", snd_strerror (err))); - return FALSE; - } } static gboolean -- 2.7.4