Testing audiomixer with GstHarness

Maxim Dzhura m.dzhura at gmail.com
Fri Oct 18 07:43:01 UTC 2024


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<GstHarness, GstHarnessDeleter>;

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


More information about the gstreamer-devel mailing list