Moving element between pipelines in PLAYING state

Vladan Jovanovic vladan.jovanovic at gmail.com
Tue Sep 12 09:33:13 UTC 2023


Will answer my own question here for anybody that might encounter the same
issue - eventually I found out that due to different running times of the
two pipelines, pad offset for the stream that is inserted needs to be
adjusted.

For the example given it would look something like:

gst_element_query_position(GstPipeline-1,GST_FORMAT_TIME,&pipeline_offset);

gst_element_query_position(GstPipeline-2,GST_FORMAT_TIME,&backup_pipeline_offset);

        gst_pad_set_offset(gst_element_get_static_pad (video5,

g_object_get_data(G_OBJECT(video5), "active_src_pad")),

pipeline_offset-backup_pipeline_offset);

br,
Vladan


On Thu, Feb 2, 2023 at 12:53 PM Vladan Jovanovic <vladan.jovanovic at gmail.com>
wrote:

> Hi,
>
> What should be considered when moving an element between two GstPipelines
> in PLAYING state when expected behavior is for the element to just continue
> generating buffers continuously (without changing stream position)?
>
> Haven't found a good description of this in documentation and I'm seeing unusual
> behavior in a small application in which I'm testing dynamic pipeline
> modifications.
>
> For some background of what I'm doing, simplified pipelines are shown
> below.
>  - GstPipeline-1 is the main pipeline where four videos are initially
> composed and shown on screen.
>  - After 10s GstPipeline-2 is started.
>  - Following instructions in (1) I modify pipelines, while in PLAYING
> state, so that video1 and video5 elements swap places in pipelines.
>
> I would like that video5 continues from where it was prior to being moved
> to GstPipeline-1. However this is not the case, and video5 skips 10s of
> video and continues as if it was started at same time as other videos in
> GstPipeline-1.
>
> It almost seems that pipelines start_time needs to be the same for all
> elements and this affects video5 once it's in GstPipeline-1?
> Is there a way to swap in video and just have it continue from the same
> stream position where it was prior to being moved to a new GstPipeline?
>
>      .---------------------------------------------------.
>      |                                   GstPipeline-1   |
>      |  .-----------.    .------------.                  |
>      |  |  video1   |--->|            |                  |
>      |  '-----------'    |            |                  |
>      |  .-----------.    |            |                  |
>      |  |  video2   |--->|            |                  |
>      |  '-----------'    | compositor |    .------------.|
>      |  .-----------.    |            |--->| videosink1 ||
>      |  |  video3   |--->|            |    '------------'|
>      |  '-----------'    |            |                  |
>      |  .-----------.    |            |                  |
>      |  |  video4   |--->|            |                  |
>      |  '-----------'    '------------'                  |
>      |                                                   |
>      '---------------------------------------------------'
>
>      .---------------------------------------------------.
>      |  .-----------.    .------------.  GstPipeline-2   |
>      |  |  video5   |--->| videosink2 |                  |
>      |  '-----------'    '------------'                  |
>      '---------------------------------------------------'
>
> best regards,
> Vladan
>
> (1):
> https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230912/3f6fe18a/attachment.htm>


More information about the gstreamer-devel mailing list