appsrc: handle duration query only if the property was set
authorPhilippe Normand <philn@igalia.com>
Sat, 12 Aug 2017 14:46:28 +0000 (15:46 +0100)
committerPhilippe Normand <philn@igalia.com>
Sat, 12 Aug 2017 15:23:27 +0000 (16:23 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=786200

gst-libs/gst/app/gstappsrc.c

index 2fde8a2..1d53797 100644 (file)
@@ -938,8 +938,12 @@ gst_app_src_query (GstBaseSrc * src, GstQuery * query)
         gst_query_set_duration (query, format, priv->size);
         res = TRUE;
       } else if (format == GST_FORMAT_TIME) {
-        gst_query_set_duration (query, format, priv->duration);
-        res = TRUE;
+        if (priv->duration != GST_CLOCK_TIME_NONE) {
+          gst_query_set_duration (query, format, priv->duration);
+          res = TRUE;
+        } else {
+          res = FALSE;
+        }
       } else {
         res = FALSE;
       }