MMFMWK-7954 waylandsink: add fps print
upstream status: imx specific
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 4b8e7f9..0322190 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -210,6 +210,8 @@
g_mutex_init (&sink->display_lock);
g_mutex_init (&sink->render_lock);
g_cond_init (&sink->redraw_wait);
+ sink->frame_showed = 0;
+ sink->run_time = 0;
}
static void
@@ -365,6 +367,9 @@
return ret;
switch (transition) {
+ case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+ sink->run_time = gst_element_get_start_time (element);
+ break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_buffer_replace (&sink->last_buffer, NULL);
if (sink->window) {
@@ -396,6 +401,14 @@
}
g_mutex_unlock (&sink->display_lock);
g_clear_object (&sink->pool);
+
+ if (sink->run_time > 0) {
+ g_print ("Total showed frames (%lld), playing for (%"GST_TIME_FORMAT"), fps (%.3f).\n",
+ sink->frame_showed, GST_TIME_ARGS (sink->run_time),
+ (gfloat)GST_SECOND * sink->frame_showed / sink->run_time);
+ }
+ sink->frame_showed = 0;
+ sink->run_time = 0;
break;
default:
break;
@@ -856,6 +869,7 @@
}
done:
{
+ sink->frame_showed++;
g_mutex_unlock (&sink->render_lock);
return ret;
}
diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
index 5224138..ff396e4 100644
--- a/ext/wayland/gstwaylandsink.h
+++ b/ext/wayland/gstwaylandsink.h
@@ -67,6 +67,10 @@
GCond redraw_wait;
GMutex render_lock;
GstBuffer *last_buffer;
+
+ /* fps print support */
+ guint64 frame_showed;
+ GstClockTime run_time;
};
struct _GstWaylandSinkClass