adaptivedemux: Handle live duration queries
authorEdward Hervey <edward@centricular.com>
Tue, 19 May 2020 08:27:18 +0000 (10:27 +0200)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 8 Jun 2020 08:44:27 +0000 (08:44 +0000)
Handle it the same way live sources would, that it by handling the query and
return an unknown duration.

Fixes #566

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

gst-libs/gst/adaptivedemux/gstadaptivedemux.c

index 65d7157..9b5aba0 100644 (file)
@@ -1956,6 +1956,13 @@ gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
 
       gst_query_parse_duration (query, &fmt, NULL);
 
+      if (gst_adaptive_demux_is_live (demux)) {
+        /* We are able to answer this query: the duration is unknown */
+        gst_query_set_duration (query, fmt, -1);
+        ret = TRUE;
+        break;
+      }
+
       if (fmt == GST_FORMAT_TIME
           && g_atomic_int_get (&demux->priv->have_manifest)) {
         duration = demux_class->get_duration (demux);