progressreport: add support for using format=buffers with do-query=false

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
This commit is contained in:
William Manley 2015-12-18 15:34:52 +00:00 committed by Tim-Philipp Müller
parent 2538fee2fd
commit 77cdb23850
2 changed files with 6 additions and 0 deletions

View 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;
}

View 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 */