Re: Testing audiomixer with GstHarness
Olivier CrĂȘte via gstreamer-devel <[email protected]> Tue, 22 Oct 2024 16:07:16 -0400
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
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 ---=20
> Hi all,
>=20
> 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:
>=20
> struct GstHarnessDeleter
> {
> void operator()( GstHarness* h )
> {
> gst_harness_teardown( h );
> }
> };
>=20
> using GstHarnessUPtr =3D std::unique_ptr;
>=20
> TEST( audiomixer, run )
> {
> GstHarnessUPtr h( gst_harness_new_with_padnames( "audiomixer",
> "sink_0", "src" ) );
> //GstHarnessUPtr h( gst_harness_new( "identity" ) ); <- passes
>=20
> gst_harness_add_src_parse( h.get(), "audiotestsrc is-live=3Dtrue", T=
RUE );
>=20
> gst_harness_set_src_caps_str( h.get(),
> "audio/x-raw,format=3DS32LE,rate=3D44100,channels=3D2,layout=3Dinterleav=
ed" );
>=20
> 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() ) );
> }
>=20
> The failure is
> Expected equality of these values:
> 1
> gst_harness_buffers_received( h.get() )
> Which is: 0
>=20
>=20
> 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.
>=20
> I run out of ideas why it doesn't work.
>=20
> Regards,
> Maxim
>=20
> --=20
> Maxim Dzhura
>=20
--=20
Olivier Cr=C3=AAte
Multimedia Lead
[email protected]