diff options
author | Josep Torra <n770galaxy@gmail.com> | 2013-09-20 10:38:12 +0200 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2013-09-20 10:38:12 +0200 |
commit | a468fe053a2825a8a708d73f2eba9685de859eac (patch) | |
tree | ed60d58b9ff4db5dd2b63e9dd1f36276a86363d8 | |
parent | 463557543acdbeb7fa8da85b6cc90edc1abf9c71 (diff) | |
download | gst-omx-a468fe053a2825a8a708d73f2eba9685de859eac.tar.gz |
examples: display QoS statistics
-rw-r--r-- | examples/egl/testegl.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/examples/egl/testegl.c b/examples/egl/testegl.c index 573704a..cb05b84 100644 --- a/examples/egl/testegl.c +++ b/examples/egl/testegl.c @@ -164,6 +164,10 @@ typedef struct /* Rendering thread state */ gboolean running; + + /* number of rendered and dropped frames */ + guint64 rendered; + guint64 dropped; } APP_STATE_T; static void init_ogl (APP_STATE_T * state); @@ -904,7 +908,7 @@ init_playbin_player (APP_STATE_T * state, const gchar * uri) GstElement *vsink; vsink = gst_element_factory_make ("fakesink", "vsink"); - g_object_set (vsink, "sync", TRUE, "silent", TRUE, + g_object_set (vsink, "sync", TRUE, "silent", TRUE, "qos", TRUE, "enable-last-buffer", FALSE, "max-lateness", 20 * GST_MSECOND, "signal-handoffs", TRUE, NULL); @@ -942,7 +946,7 @@ init_parse_launch_player (APP_STATE_T * state, const gchar * spipeline) return FALSE; } - g_object_set (vsink, "sync", TRUE, "silent", TRUE, + g_object_set (vsink, "sync", TRUE, "silent", TRUE, "qos", TRUE, "enable-last-buffer", FALSE, "max-lateness", 20 * GST_MSECOND, "signal-handoffs", TRUE, NULL); @@ -1057,8 +1061,7 @@ handle_keyboard (GIOChannel * source, GIOCondition cond, APP_STATE_T * state) seek_backward (state); break; case 'q': - flush_start (state); - gst_element_set_state (state->pipeline, GST_STATE_READY); + gst_element_send_event (state->pipeline, gst_event_new_eos ()); break; } } @@ -1135,6 +1138,19 @@ state_changed_cb (GstBus * bus, GstMessage * msg, APP_STATE_T * state) } } +static void +qos_cb (GstBus * bus, GstMessage * msg, APP_STATE_T * state) +{ + GstFormat fmt = GST_FORMAT_BUFFERS; + gchar *name = gst_element_get_name (GST_MESSAGE_SRC (msg)); + gst_message_parse_qos_stats (msg, &fmt, &state->rendered, &state->dropped); + g_print ("%s rendered: %" G_GUINT64_FORMAT " dropped: %" G_GUINT64_FORMAT + " %s\n", + name, state->rendered, state->dropped, + (fmt == GST_FORMAT_BUFFERS ? "frames" : "samples")); + g_free (name); +} + //============================================================================== static void @@ -1303,6 +1319,7 @@ main (int argc, char **argv) g_signal_connect (G_OBJECT (bus), "message::buffering", (GCallback) buffering_cb, state); g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback) eos_cb, state); + g_signal_connect (G_OBJECT (bus), "message::qos", (GCallback) qos_cb, state); g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback) state_changed_cb, state); gst_object_unref (bus); |