adding filesrc inputs dinamycally to videomixer

Sebastian Dröge sebastian at centricular.com
Wed Jan 15 07:21:28 PST 2014


On Di, 2014-01-14 at 17:41 -0200, Lautaro Woites wrote:
> Hi people,
> 
> I'm trying to add inputs to videomixer from filesrc dynamically.
> I have a videotestsrc as background (with is-live=TRUE).
> When I want to add a new input I create a bin with
> filesrc, decodebin, videorate and videoconvert.
> Then I request a pad on the mixer and I link it to the bin.
> 
> It works  OK but not as I need. Every time I add a new input to the mixer
> the video file start from the current running time and not from the
> beginning as I expected.
> 
> I've tried to replace the first SEGMENT event at the decodebin src pad with
> a pad probe and replace it with a new event where start=0 and end=-1. But
> it seems to not make any difference.
> Also I've tried to replace the segment with a new one where the
> segment.base=<running_time_from_the_pipeline>, but the pipeline freezes.
> The log shows that the new videomixer:sink receives the segment event and
> then both mixer's sinks sent a qos event.
> 
> I've tried two ways for replace the segment event, the first one was to
> drop the first event(returning GST_PAD_PROBE_DROP) and send a new one from
> the app. (Seeing the logs the videomixer receives the two segment events).
> The other way was to replace de event on the GstPadProbeInfo on the probe.

Easier would probably be to adjust the pad offsets on the new pads, i.e.
using gst_pad_set_offset(). Note that this only works for positive
offsets currently (which is what you want), unless you use 1.2.3 (or
latest 1.2 branch or git master branch).

If you want to adjust the running time manually by intercepting the
segment events it should in theory work if you add the running time when
the videomixer pad was added to segment.base. Just overriding any
previous value there will break synchronisation.
If you get problems with QoS you should check what videomixer calculates
as running time for the buffers on the new pad and if they are what you
expect. If not debug if the segments received in videomixer are what you
expect and the buffer timestamps too.

Also check the code of gst_segment_to_running_time() to understand how
this translation works, or see draft-synchronization.txt in the
GStreamer design documents.

-- 
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140115/28d7f5fa/attachment.pgp>


More information about the gstreamer-devel mailing list