Hi Folks,
I've a custom plugin based on GstAudioAggregator. It has 2 sink pads.
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:
static int current_id = 0;
static int count = 0;
static GstFlowReturn gst_audioagg_aggregate(GstAggregator * agg, gboolean timeout)
{
GstFlowReturn ret;
gboolean pad_eos = false;
GstBuffer *outbuf = NULL;
GST_OBJECT_LOCK(agg);
for (size_t i = 0; i < g_list_length(GST_ELEMENT(agg)->sinkpads); ++i)
{
GstAggregatorPad *aggpad = (GstAggregatorPad *) (g_list_nth_data(GST_ELEMENT(agg)->sinkpads, i));
pad_eos = gst_aggregator_pad_is_eos(aggpad);
if (!pad_eos)
{
// Choose one pad and drop the other one.
if (i == current_id)
outbuf = gst_aggregator_pad_pop_buffer(aggpad);
else
gst_aggregator_pad_drop_buffer(aggpad);
}
}
GST_OBJECT_UNLOCK(agg);
//
// Change the sink pad after 100 iteration. It means output 2 seconds audio from first sink pad
// then 2 seconds of audio from second sink pad, then again 2 second audio from first and etc.
//
count ++;
if (count == 100)
{
count = 0;
current_id ++;
if (current_id == 2)
current_id = 0;
}
if (!pad_eos && outbuf)
ret = gst_aggregator_finish_buffer(agg, outbuf);
else
ret = GST_FLOW_EOS;
//
// We only post the message here, because we can't post it while the object
// is locked.
//
return ret;
}
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 audioresample) before passing to the audio aggregator element:
ERROR qtmux gstqtmux.c:4535:gst_qt_mux_add_buffer: decreasing DTS value 0:00:02.131927438 < 0:00:04.643990929
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.
Thanks,
Lusine
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel