mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 02:30:35 +00:00
fpsdisplaysink: Log final statistics on stop
Add a final message to the debug log that lists the min, max and average framerates when state of fpsdisplaysink transisions to NULL. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3988>
This commit is contained in:
parent
573eecac30
commit
56cc2132da
1 changed files with 22 additions and 7 deletions
|
@ -363,6 +363,9 @@ display_current_fps (gpointer data)
|
|||
time_diff = (gdouble) (current_ts - self->last_ts) / GST_SECOND;
|
||||
time_elapsed = (gdouble) (current_ts - self->start_ts) / GST_SECOND;
|
||||
|
||||
if (G_UNLIKELY (time_diff <= 0 && time_elapsed <= 0))
|
||||
return TRUE;
|
||||
|
||||
rr = (gdouble) (frames_rendered - self->last_frames_rendered) / time_diff;
|
||||
dr = (gdouble) (frames_dropped - self->last_frames_dropped) / time_diff;
|
||||
|
||||
|
@ -476,6 +479,22 @@ no_text_overlay:
|
|||
static void
|
||||
fps_display_sink_stop (GstFPSDisplaySink * self)
|
||||
{
|
||||
gchar *fps_message;
|
||||
gdouble time_elapsed, average_fps;
|
||||
time_elapsed = (gdouble) (self->last_ts - self->start_ts) / GST_SECOND;
|
||||
|
||||
if (G_LIKELY (time_elapsed > 0))
|
||||
average_fps = (gdouble) self->frames_rendered / time_elapsed;
|
||||
else
|
||||
average_fps = 0;
|
||||
|
||||
/* print the max and minimum fps values */
|
||||
fps_message =
|
||||
g_strdup_printf ("Max-fps: %0.2f, Min-fps: %0.2f, Average-fps: %0.2f",
|
||||
self->max_fps, self->min_fps, average_fps);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "%s", fps_message);
|
||||
|
||||
if (self->text_overlay) {
|
||||
gst_element_unlink (self->text_overlay, self->video_sink);
|
||||
gst_bin_remove (GST_BIN (self), self->text_overlay);
|
||||
|
@ -484,17 +503,13 @@ fps_display_sink_stop (GstFPSDisplaySink * self)
|
|||
}
|
||||
|
||||
if (!self->silent) {
|
||||
gchar *str;
|
||||
|
||||
/* print the max and minimum fps values */
|
||||
str =
|
||||
g_strdup_printf ("Max-fps: %0.2f, Min-fps: %0.2f", self->max_fps,
|
||||
self->min_fps);
|
||||
GST_OBJECT_LOCK (self);
|
||||
g_free (self->last_message);
|
||||
self->last_message = str;
|
||||
self->last_message = fps_message;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
g_object_notify_by_pspec ((GObject *) self, pspec_last_message);
|
||||
} else {
|
||||
g_free (fps_message);
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
|
|
Loading…
Reference in a new issue