Testing audiomixer with GstHarness
Olivier Crête
olivier.crete at collabora.com
Tue Oct 22 20:07:16 UTC 2024
Hi,
The audiomixer element has a thread, so you want to wait for it to do it's thing, you can use gst_harness_pull_until_eos() to wait for a buffer or EOS event to be received instead of gst_harness_buffers_received() which doesn't wait.
Olivier
---- On Fri, 18 Oct 2024 03:43:01 -0400 Maxim Dzhura via gstreamer-devel wrote ---
> Hi all,
>
> I am trying to write a unit test for audiomixer using GstHarness. It
> always fails, but succeeds when replace audiomixer for identity
> element. I am using gstreamer 1.22.6, C++ and gtest. Here is the code:
>
> struct GstHarnessDeleter
> {
> void operator()( GstHarness* h )
> {
> gst_harness_teardown( h );
> }
> };
>
> using GstHarnessUPtr = std::unique_ptr;
>
> TEST( audiomixer, run )
> {
> GstHarnessUPtr h( gst_harness_new_with_padnames( "audiomixer",
> "sink_0", "src" ) );
> //GstHarnessUPtr h( gst_harness_new( "identity" ) ); <- passes
>
> gst_harness_add_src_parse( h.get(), "audiotestsrc is-live=true", TRUE );
>
> gst_harness_set_src_caps_str( h.get(),
> "audio/x-raw,format=S32LE,rate=44100,channels=2,layout=interleaved" );
>
> ASSERT_EQ( GST_FLOW_OK, gst_harness_src_crank_and_push_many(
> h.get(), 1, 1) );
> ASSERT_EQ( 1, gst_harness_buffers_received( h.get() ) );
> }
>
> The failure is
> Expected equality of these values:
> 1
> gst_harness_buffers_received( h.get() )
> Which is: 0
>
>
> I checked buffers arriver to audiomixer sink pad with GST_SCHEDULE,
> and audiomixer goes into PLAYING state. As well I check
> audioaggregator and GST_PADS logs for extra sink pads, so I don't
> think audiomixer is waiting for data.
>
> I run out of ideas why it doesn't work.
>
> Regards,
> Maxim
>
> --
> Maxim Dzhura
>
--
Olivier Crête
Multimedia Lead
olivier.crete at collabora.com
More information about the gstreamer-devel
mailing list