progressreport: add support for using format=buffers with do-query=false
authorWilliam Manley <will@williammanley.net>
Fri, 18 Dec 2015 15:34:52 +0000 (15:34 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 20 Dec 2015 20:28:56 +0000 (20:28 +0000)
This is useful for investigating and debugging pipelines which are
producing buffers at a slower/faster rate than you would expect.

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

gst/debugutils/progressreport.c
gst/debugutils/progressreport.h

index 7dd05dc..1426ca8 100644 (file)
@@ -252,6 +252,9 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
       cur = gst_segment_to_stream_time (&base->segment, format,
           GST_BUFFER_TIMESTAMP (buf));
       total = base->segment.duration;
+    } else if (format == GST_FORMAT_BUFFERS) {
+      cur = filter->buffer_count;
+      total = -1;
     } else {
       return FALSE;
     }
@@ -411,6 +414,7 @@ gst_progress_report_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
   GST_OBJECT_LOCK (filter);
   need_update =
       ((cur_time.tv_sec - filter->last_report.tv_sec) >= filter->update_freq);
+  filter->buffer_count++;
   GST_OBJECT_UNLOCK (filter);
 
   if (need_update) {
@@ -432,6 +436,7 @@ gst_progress_report_start (GstBaseTransform * trans)
 
   g_get_current_time (&filter->last_report);
   filter->start_time = filter->last_report;
+  filter->buffer_count = 0;
 
   return TRUE;
 }
index c46ac09..d990937 100644 (file)
@@ -50,6 +50,7 @@ struct _GstProgressReport
   gboolean do_query;
   GTimeVal start_time;
   GTimeVal last_report;
+  gint64 buffer_count;
 
   /* Format used for querying. Using a string here because the
    * format might not be registered yet when the property is set */