From 26ef55d6220d00367731f2db2bd8f926edbe6165 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 13 Oct 2014 16:28:54 +0200 Subject: [PATCH] validate: Print position if it could properly be queried Otherwize we will print meaningless garbage. --- .../gst/validate/gst-validate-bin-monitor.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/validate/gst/validate/gst-validate-bin-monitor.c b/validate/gst/validate/gst-validate-bin-monitor.c index e224e57e7c..34bbc64e38 100644 --- a/validate/gst/validate/gst-validate-bin-monitor.c +++ b/validate/gst/validate/gst-validate-bin-monitor.c @@ -161,20 +161,29 @@ print_position (GstValidateMonitor * monitor) gdouble rate = 1.0; GstFormat format = GST_FORMAT_TIME; - gst_element_query_position (pipeline, format, &position); + if (!gst_element_query_position (pipeline, format, &position)) { + GST_DEBUG_OBJECT (monitor, "Could not query position"); + + return TRUE; + } format = GST_FORMAT_TIME; - gst_element_query_duration (pipeline, format, &duration); + if (!gst_element_query_duration (pipeline, format, &duration)) { + GST_DEBUG_OBJECT (monitor, "Could not query duration"); + + return TRUE; + } query = gst_query_new_segment (GST_FORMAT_DEFAULT); - if (gst_element_query (pipeline, query)) + if (gst_element_query (pipeline, query)) { gst_query_parse_segment (query, &rate, NULL, NULL, NULL); - gst_query_unref (query); - gst_validate_printf (NULL, - "\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration), - rate); + gst_validate_printf (NULL, + "\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration), + rate); + } + gst_query_unref (query); return TRUE; }