srtsrc: Defend against missing clock
authorJan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
Mon, 12 Oct 2020 12:09:28 +0000 (14:09 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 12 Oct 2020 12:58:22 +0000 (12:58 +0000)
If we don't have a clock, stop the source instead of asserting in
gst_clock_get_time. This can happen when the element is removed from the
pipeline while it's playing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1674>

ext/srt/gstsrtsrc.c

index c886e39..5839d7e 100644 (file)
@@ -140,6 +140,11 @@ gst_srt_src_fill (GstPushSrc * src, GstBuffer * outbuf)
 
   /* Get clock and values */
   clock = gst_element_get_clock (GST_ELEMENT (src));
+  if (!clock) {
+    GST_DEBUG_OBJECT (src, "Clock missing, flushing");
+    return GST_FLOW_FLUSHING;
+  }
+
   base_time = gst_element_get_base_time (GST_ELEMENT (src));
 
   recv_len = gst_srt_object_read (self->srtobject, info.data,