pulsesrc: don't assert in get_time() when called after shutdown
authorTim-Philipp Müller <tim@centricular.net>
Sat, 27 Oct 2012 23:07:46 +0000 (00:07 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Tue, 30 Oct 2012 23:26:39 +0000 (23:26 +0000)
Which might happen if the source gets set to NULL state before
the rest of the pipeline.

https://bugzilla.gnome.org/show_bug.cgi?id=686985

ext/pulse/pulsesrc.c

index 6003d13..12f847d 100644 (file)
@@ -1754,6 +1754,9 @@ gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src)
 {
   pa_usec_t time = 0;
 
+  if (src->mainloop == NULL)
+    goto out;
+
   pa_threaded_mainloop_lock (src->mainloop);
   if (!src->stream)
     goto unlock_and_out;
@@ -1772,5 +1775,6 @@ gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src)
 unlock_and_out:
   pa_threaded_mainloop_unlock (src->mainloop);
 
+out:
   return time;
 }