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

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

Commit Message

Vedant Paranjape Aug. 28, 2021, 6:18 p.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>
---
> I would like some minimal validation. I would expect that after 2s some frames
> got "rendered" properly. You can read the GstStructure property "stats" from
> fakevideosink / fakesink, and read the "rendered" field. Make sure this not zero
> perhaps ?

This change was suggested by Nicolas Dufresne <nicolas@ndufresne.ca> in the
mailing list 
---
 test/gstreamer/gstreamer_single_stream_test.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Vedant Paranjape Aug. 29, 2021, 10:13 a.m. UTC | #1
Hello Laurent,
I think this patch should be merged before adding multistream test.

Regards,
*Vedant Paranjape*

On Sat, Aug 28, 2021 at 11:48 PM Vedant Paranjape <
vedantparanjape160201@gmail.com> 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>
> ---
> > I would like some minimal validation. I would expect that after 2s some
> frames
> > got "rendered" properly. You can read the GstStructure property "stats"
> from
> > fakevideosink / fakesink, and read the "rendered" field. Make sure this
> not zero
> > perhaps ?
>
> This change was suggested by Nicolas Dufresne <nicolas@ndufresne.ca> in
> the
> mailing list
> ---
>  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..5d56e762 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;
> --
> 2.25.1
>
>

Patch
diff mbox series

diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp
index 4c8d4804..5d56e762 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;