Dynamically add filesrc to audiomixer: 'pad not activated yet'

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dynamically add filesrc to audiomixer: 'pad not activated yet'

GStreamer-devel mailing list
I have a send-only pipeline constructed as follows:
 "webrtcbin name=sendonly bundle-policy=max-bundle autoaudiosrc ! queue ! audioconvert ! audioresample ! audiomixer name=mix ! volume name=vol ! level message=TRUE ! queue ! opusenc inband-fec=TRUE ! rtpopuspay ! queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=111,clock-rate=48000 ! sendonly.sink_0 "
 
 In response to UI interaction I'd like to play a short sample mixed in. The following code *partially* works: playback starts up to a couple of seconds after user interaction, but only for a long file (nothing if I try sample files of order 2s or less). Log output shows:
 gst_base_src_start_complete:<filesrc0> pad not activated yet
 
To finish this up, I'd expect to add a probe to detect EOS & then remove the bin. Is a probe and wait for something required as part of startup for the bin?

GstElement *mixer = gst_bin_get_by_name(GST_BIN (pipeline), "mix");
    if (mixer) {
        GstPad *mixerSink, *binSrc, *resamplerSrc;
        GstElement *bin, *filesrc, *parse, *dec, *convert, *resample;
        GstPadLinkReturn ret;

        bin = gst_bin_new(NULL);
        g_assert(bin);
        filesrc = gst_element_factory_make("filesrc", NULL);
        g_assert (filesrc);
        parse = gst_element_factory_make("mpegaudioparse", NULL);
        g_assert (parse);
        dec = gst_element_factory_make("mpg123audiodec", NULL);
        g_assert (dec);
        convert = gst_element_factory_make("audioconvert", NULL);
        g_assert(convert);
        resample = gst_element_factory_make("audioresample", NULL);
        g_assert(resample);

        g_object_set(filesrc, "location", name, NULL);
        gst_bin_add_many(GST_BIN (bin), filesrc, parse, dec, convert, resample, NULL);

        gboolean linkRet = gst_element_link_many(filesrc, parse, dec, convert, resample, NULL);
        g_assert (linkRet == TRUE);

        // create a ghost pad on the bin
        resamplerSrc = gst_element_get_static_pad(resample, "src");
        gst_element_add_pad(bin, gst_ghost_pad_new("src", resamplerSrc));
        gst_object_unref(resamplerSrc);

        // now add the new bin to the pipeline
        gst_bin_add(GST_BIN(pipeline), bin);

        mixerSink = gst_element_get_request_pad(mixer, "sink_%u");
        binSrc = gst_element_get_static_pad(bin, "src");
        ret = gst_pad_link(binSrc, mixerSink);
        g_assert (ret == GST_PAD_LINK_OK);

        // OK, start it up...
        gst_element_set_state(bin, GST_STATE_READY);
        gst_element_set_state(bin, GST_STATE_PLAYING);

        gst_object_unref(binSrc);
        gst_object_unref(mixerSink);
        gst_object_unref(mixer);
    }

any insight greatly appreciated!

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel