stream: Use stream duration as stream-stop if segment was not configured with a stop
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Fri, 2 Jun 2017 19:37:54 +0000 (15:37 -0400)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Thu, 5 Oct 2017 15:07:13 +0000 (12:07 -0300)
Allowing client to know stream duration when no seeking happened.

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

gst/rtsp-server/rtsp-stream.c

index 6e8c97a..25ff9c9 100644 (file)
@@ -3852,7 +3852,20 @@ gst_rtsp_stream_query_stop (GstRTSPStream * stream, gint64 * stop)
     if (format != GST_FORMAT_TIME)
       *stop = -1;
   }
+
   gst_query_unref (query);
+  if (!GST_CLOCK_TIME_IS_VALID (*stop)) {
+    query = gst_query_new_duration (GST_FORMAT_TIME);
+    if ((ret = gst_element_query (sink, query))) {
+      GstFormat format;
+
+      gst_query_parse_duration (query, &format, stop);
+      if (format != GST_FORMAT_TIME)
+        *stop = -1;
+    }
+    gst_query_unref (query);
+  }
+
   gst_object_unref (sink);
 
   return ret;