gst-plugins-good: pulsesrc: additional error condition checking
Mark Nauwelaerts
mnauw at kemper.freedesktop.org
Fri Jan 20 08:24:18 PST 2012
Module: gst-plugins-good
Branch: master
Commit: e44d9302899c48e849cb0e488c950a4d9dd86384
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=e44d9302899c48e849cb0e488c950a4d9dd86384
Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date: Fri Jan 20 16:47:36 2012 +0100
pulsesrc: additional error condition checking
---
ext/pulse/pulsesrc.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c
index 98f7f0c..12e5282 100644
--- a/ext/pulse/pulsesrc.c
+++ b/ext/pulse/pulsesrc.c
@@ -1677,10 +1677,13 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
- this->mainloop = pa_threaded_mainloop_new ();
- g_assert (this->mainloop);
-
- pa_threaded_mainloop_start (this->mainloop);
+ if (!(this->mainloop = pa_threaded_mainloop_new ()))
+ goto mainloop_failed;
+ if (pa_threaded_mainloop_start (this->mainloop) < 0) {
+ pa_threaded_mainloop_free (this->mainloop);
+ this->mainloop = NULL;
+ goto mainloop_start_failed;
+ }
if (!this->mixer)
this->mixer =
@@ -1730,4 +1733,18 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition)
}
return ret;
+
+ /* ERRORS */
+mainloop_failed:
+ {
+ GST_ELEMENT_ERROR (this, RESOURCE, FAILED,
+ ("pa_threaded_mainloop_new() failed"), (NULL));
+ return GST_STATE_CHANGE_FAILURE;
+ }
+mainloop_start_failed:
+ {
+ GST_ELEMENT_ERROR (this, RESOURCE, FAILED,
+ ("pa_threaded_mainloop_start() failed"), (NULL));
+ return GST_STATE_CHANGE_FAILURE;
+ }
}
More information about the gstreamer-commits
mailing list