1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
From cbe0f26aef2ab0e8004bdc75fe1e0a053e649642 Mon Sep 17 00:00:00 2001
From: Haihua Hu <b55597@freescale.com>
Date: Wed, 18 Nov 2015 15:10:22 +0800
Subject: [PATCH 11/26] 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>
Conflicts:
ext/gl/gstglimagesink.h
---
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 75d3214..e697bd0 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -766,6 +766,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;
@@ -1169,7 +1171,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];
@@ -1261,6 +1266,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;
@@ -1759,6 +1772,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 0723e08..405db44 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -143,6 +143,10 @@ struct _GstGLImageSink
GstGLRotateMethod current_rotate_method;
GstGLRotateMethod rotate_method;
const gfloat *transform_matrix;
+
+ /* fps print support */
+ guint64 frame_showed;
+ GstClockTime run_time;
};
struct _GstGLImageSinkClass
--
1.9.1
|