Seeking a pipeline with live streams

Sebastian Dröge sebastian at centricular.com
Fri Dec 13 11:02:29 PST 2013


On Sa, 2013-12-07 at 06:57 +0200, Andrei Melnikov wrote:
> On 29 October 2013 10:48, Sebastian Dröge <sebastian at centricular.com> wrote:
> 
> > (I'm going to answer this for 1.0 now, things are different in 0.10)
> >
> > For the simple case where you just seek on the non-live part of the
> > pipeline you could either
> > 1) add a pad probe on the srcpad before the videomixer sinkpad and
> > intercept the SEGMENT event and adjust segment.base or
> > 2) set the "offset" property on the pad
> >
> > This should be set to the running time of that stream before the seek,
> > basically to the time to which the first buffer after the seek should be
> > synchronized to (which is approximately the same as the running time of
> > the live stream at that time).
> >
> 
> How do I modify the segment? I add a probe with gst_pad_add_probe and
> then I can get an Event * by using gst_pad_probe_info_get_event ().
> But then documentation for gst_event_parse_segment () says I shouldn't
> modify the segment in place. Am I supposed to somehow stop the old
> event from propagation and push a new event using gst_pad_push_event?

Yes

> What is the difference between gst_pad_set_event_function_full () and
> pad probes with GST_PAD_PROBE_TYPE_EVENT_BOTH flag set?

set_event_function() must only be used by the elements themselves for
their own pads. You should not use it on any pads that you didn't
create, especially not on any pads that belong to some other element :)

Pad probes on the other hand are meant to be used from outside the
element that owns the pads to intercept and modify events, buffers and
queries.

> The "offset" approach is simpler but doesn't work.
> 
> Currently I call gst_element_seek_simple () with Segment and KeyUnit
> flags on avdec element in non-live part and call gst_pad_set_offset()
> to change offset.
> 
> I also query position on avdec element and position seems never going
> to 0 after the seek so I suppose I do something wrong. Should I
> disconnect the non-live part before seeking it?

It might be necessary to not let the seek event go into the live part of
the pipeline (can be done via pad probes too). Or that something else is
wrong :) Without more information of what exactly you and what exactly
happens (e.g. if you read the debug logs) do I can only guess.

-- 
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: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131213/1fae1f28/attachment.pgp>


More information about the gstreamer-devel mailing list