82 lines
2.7 KiB
Diff
82 lines
2.7 KiB
Diff
From f6edb394cc6ada3ce98e2cf9021e6a2ead3b4daf Mon Sep 17 00:00:00 2001
|
|
From: Haihua Hu <b55597@freescale.com>
|
|
Date: Wed, 18 Nov 2015 15:10:22 +0800
|
|
Subject: [PATCH] Add fps print in glimagesink
|
|
|
|
In GST-1.6, Pipeline will set start time to 0 when state
|
|
change form PAUSE to READY, so get start time in state change
|
|
PLAYING_PAUSE.
|
|
|
|
Upstream-Status: Inappropriate [i.MX specific]
|
|
|
|
Signed-off-by: Haihua Hu <b55597@freescale.com>
|
|
Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
|
|
---
|
|
ext/gl/gstglimagesink.c | 15 +++++++++++++++
|
|
ext/gl/gstglimagesink.h | 4 ++++
|
|
2 files changed, 19 insertions(+)
|
|
|
|
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
|
|
index 196757adfbac..185577f2a07e 100644
|
|
--- a/ext/gl/gstglimagesink.c
|
|
+++ b/ext/gl/gstglimagesink.c
|
|
@@ -603,6 +603,8 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
|
|
glimage_sink->overlay_compositor = NULL;
|
|
glimage_sink->cropmeta = NULL;
|
|
glimage_sink->prev_cropmeta = NULL;
|
|
+ glimage_sink->frame_showed = 0;
|
|
+ glimage_sink->run_time = 0;
|
|
|
|
glimage_sink->mview_output_mode = DEFAULT_MULTIVIEW_MODE;
|
|
glimage_sink->mview_output_flags = DEFAULT_MULTIVIEW_FLAGS;
|
|
@@ -978,7 +980,10 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
switch (transition) {
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
+ {
|
|
+ glimage_sink->run_time = gst_element_get_start_time (GST_ELEMENT (glimage_sink));
|
|
break;
|
|
+ }
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
{
|
|
GstBuffer *buf[2];
|
|
@@ -1070,6 +1075,14 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
|
|
g_slice_free(GstVideoCropMeta, glimage_sink->prev_cropmeta);
|
|
glimage_sink->prev_cropmeta = NULL;
|
|
|
|
+ if (glimage_sink->run_time > 0) {
|
|
+ g_print ("Total showed frames (%lld), playing for (%"GST_TIME_FORMAT"), fps (%.3f).\n",
|
|
+ glimage_sink->frame_showed, GST_TIME_ARGS (glimage_sink->run_time),
|
|
+ (gfloat)GST_SECOND * glimage_sink->frame_showed / glimage_sink->run_time);
|
|
+ }
|
|
+
|
|
+ glimage_sink->frame_showed = 0;
|
|
+ glimage_sink->run_time = 0;
|
|
break;
|
|
default:
|
|
break;
|
|
@@ -1568,6 +1581,8 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|
return GST_FLOW_ERROR;
|
|
}
|
|
|
|
+ glimage_sink->frame_showed++;
|
|
+
|
|
return GST_FLOW_OK;
|
|
|
|
/* ERRORS */
|
|
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
|
|
index 317055a016ed..f9a052a12ed8 100644
|
|
--- a/ext/gl/gstglimagesink.h
|
|
+++ b/ext/gl/gstglimagesink.h
|
|
@@ -125,6 +125,10 @@ struct _GstGLImageSink
|
|
GstGLStereoDownmix mview_downmix_mode;
|
|
|
|
GstGLOverlayCompositor *overlay_compositor;
|
|
+
|
|
+ /* fps print support */
|
|
+ guint64 frame_showed;
|
|
+ GstClockTime run_time;
|
|
};
|
|
|
|
struct _GstGLImageSinkClass
|