[libcamera-devel,v2] test: gstreamer: Add minimal validation of camera output
diff mbox series

Message ID 20210829113012.525417-1-vedantparanjape160201@gmail.com
State New
Headers show
Series
  • [libcamera-devel,v2] test: gstreamer: Add minimal validation of camera output
Related show

Commit Message

Vedant Paranjape Aug. 29, 2021, 11:30 a.m. UTC
Read stats property of fakesink which has Sink Statistics, It is
expected to be a non-zero number after running gstreamer element
for two seconds.

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
---
 test/gstreamer/gstreamer_single_stream_test.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Laurent Pinchart Aug. 29, 2021, 4:53 p.m. UTC | #1
i
Hi Vedant,

Thank you for the patch.

On Sun, Aug 29, 2021 at 05:00:12PM +0530, Vedant Paranjape wrote:
> Read stats property of fakesink which has Sink Statistics, It is
> expected to be a non-zero number after running gstreamer element
> for two seconds.
> 
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> ---
>  test/gstreamer/gstreamer_single_stream_test.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp
> index 4c8d4804..6d977262 100644
> --- a/test/gstreamer/gstreamer_single_stream_test.cpp
> +++ b/test/gstreamer/gstreamer_single_stream_test.cpp
> @@ -134,8 +134,15 @@ protected:
>  		g_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);
>  		g_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus, timeout, msgType);
>  
> +		gint sinkStats;
> +		g_object_get(sink0_, "stats", &sinkStats, NULL);
> +
>  		gst_element_set_state(pipeline_, GST_STATE_NULL);
>  
> +		if (sinkStats == 0) {

This should print an error message, as a failure without a clear message
will be confusing.

> +			return TestFail;
> +		}
> +
>  		/* Parse error message */
>  		if (msg == NULL)
>  			return TestPass;

Patch
diff mbox series

diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp
index 4c8d4804..6d977262 100644
--- a/test/gstreamer/gstreamer_single_stream_test.cpp
+++ b/test/gstreamer/gstreamer_single_stream_test.cpp
@@ -134,8 +134,15 @@  protected:
 		g_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);
 		g_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus, timeout, msgType);
 
+		gint sinkStats;
+		g_object_get(sink0_, "stats", &sinkStats, NULL);
+
 		gst_element_set_state(pipeline_, GST_STATE_NULL);
 
+		if (sinkStats == 0) {
+			return TestFail;
+		}
+
 		/* Parse error message */
 		if (msg == NULL)
 			return TestPass;