<div dir="ltr">Hi Folks,<div>I've a custom plugin based on GstAudioAggregator. It has 2 sink pads.</div><div>I've overwritten the aggregate base function where I output (gst_aggregator_finish_buffer(agg, outbuf)) one of the sink pads based on some condition - lets say I have a counter and change which sink pad to output every 100 iteration. This is the code which I have:</div><div><br></div><div>static int current_id = 0;<br>static int count = 0;<br><br>static GstFlowReturn gst_audioagg_aggregate(GstAggregator * agg, gboolean timeout)<br>{<br>    GstFlowReturn ret;<br>    gboolean pad_eos = false;<br>    GstBuffer *outbuf = NULL;<br>    GST_OBJECT_LOCK(agg);<br>    for (size_t i = 0; i < g_list_length(GST_ELEMENT(agg)->sinkpads); ++i)<br>    {<br>        GstAggregatorPad *aggpad = (GstAggregatorPad *) (g_list_nth_data(GST_ELEMENT(agg)->sinkpads, i));<br>        pad_eos = gst_aggregator_pad_is_eos(aggpad);<br>        if (!pad_eos)<br>        {</div><div>           // Choose one pad and drop the other one.<br>            if (i == current_id)<br>                outbuf = gst_aggregator_pad_pop_buffer(aggpad);<br>            else<br>                gst_aggregator_pad_drop_buffer(aggpad);<br>        }<br>    }<br>    GST_OBJECT_UNLOCK(agg);<br>      //<br>    // Change the sink pad after 100 iteration. It means output 2 seconds audio from first sink pad<br>       // then 2 seconds of audio from second sink pad, then again 2 second audio from first and etc.<br>        //<br>    count ++;<br>    if (count == 100)<br>    {<br>        count = 0;<br>        current_id ++;<br>        if (current_id == 2)<br>            current_id = 0;<br>    }<br><br>    if (!pad_eos && outbuf)<br>        ret = gst_aggregator_finish_buffer(agg, outbuf);<br>    else<br>       ret = GST_FLOW_EOS;<br>    //<br>    // We only post the message here, because we can't post it while the object<br>    // is locked.<br>    //<br>    return ret;<br>}</div><div><br></div><div>It  works correctly when both my inputs(sink pads) have the same audio rate but in case of inputs have different sample rates I get the following error message even though I do resampling(bringing to the same audio rate with <span style="color:rgb(206,145,120);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre">audioresample</span>) before passing to the audio aggregator element:</div><div>ERROR                  qtmux gstqtmux.c:4535:gst_qt_mux_add_buffer: decreasing DTS value 0:00:02.131927438 < 0:00:04.643990929<br></div><div><br></div><div>Please let me know what I'm missing. Why this code works when my input files have the same audio rate and why I get this error when both my inputs have different rates but I do audio resampling. Sorry for the long question.</div><div><br></div><div>Thanks,</div><div>Lusine</div></div>