Dynamic Pipelines

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic Pipelines

Jon L

Hello All,

 

I am looking at adding branches to a running pipeline dynamically and have run into a problem.

 

My setup is Windows 10, running GStreamer V1.18.3 MSVC, and using GstSharp V 1.18.

 

I have a very simple pipeline

 

               “videotestsrc ! capsfilter caps=\"{caps}\" ! tee name=tee ! queue ! avimux ! filesink location=C:\\\\Temp\\\\GstRecordings\\\\Test.avi”

 

Where caps are "video/x-raw, format=BGRA, height=240, width=320, framerate=30/1"

 

When the pipeline transitions to the playing state I add a timeout handler with a 2 second delay to add a branch to the ‘tee’ to display the video, the branch looks like this

 

               queue ! videoconvert ! capsfilter caps=\"{caps}\" ! autovideosink”

 

Where caps are "video/x-raw, format=NV12, height=240, width=320, framerate=30/1"

 

The branch is added, linked and synched successfully.  I can see that all the elements transition to the playing state except for the video sink which only transitions to ‘ready’ and the pipeline transitions to paused. 

 

If I swap out ‘autovideosink’ for ‘fakesink’ the same thing happens.  However, if I swap out the entire branch with the following

 

               queue ! videoconvert ! x264enc ! h264parse !capsfilter caps=\"{caps}\" ! fakesink”

 

Where caps are "video/x-h264, stream-format=byte-stream, alignment=au"

 

Then all the elements transition to playing and I can also see the pipeline transition back to playing.

 

I would be grateful for any handy hints or tips, help or assistance, especially that relating to debug categories that I could use to help identify the problem.

 

Many Thanks

 

Jon

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Pipelines

Tim Müller
On Mon, 2021-04-12 at 15:15 +0000, Jon Lovewell wrote:

Hi Jon,
 

> I am looking at adding branches to a running pipeline dynamically and
> have run into a problem.
>
>   (snip)
>
> When the pipeline transitions to the playing state I add a timeout
> handler with a 2 second delay to add a branch to the ‘tee’ to display
> the video, the branch looks like this
>  
> “queue ! videoconvert ! capsfilter caps={caps} ! autovideosink”
>  
> Where caps are "video/x-raw, format=NV12, height=240, width=320,
> framerate=30/1"
>  
> The branch is added, linked and synched successfully.  I can see that
> all the elements transition to the playing state except for the video
> sink which only transitions to ‘ready’ and the pipeline transitions
> to paused. 
>  
> If I swap out ‘autovideosink’ for ‘fakesink’ the same thing happens.

Do you have a small self-contained test case that demonstrates the
problem by any chance?

Something to double-check: you write "added, linked, and synched" in
that order, but when you add elements to an already-running pipeline
you really want to do things in this order:

 - add new elements

 - set/sync state (so elements/pads are active before someone tries to
push data into them)

 - link element to the tee (now that the elements the data flows into
are in a non-NULL state).

You can check the GST_DEBUG=*:6 log to see if you find any log lines
about streaming stopping with flow flushing - if you see that, that's
probably an indication that it tried to push data on an element still
in NULL state and then the pipeline will stop silently.

Cheers
 Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Pipelines

Jon L
In reply to this post by Jon L

Tim,

 

Many thanks for your input, my bad!

 

I was linking everything before synching the state of the new elements with that of the pipeline.

 

I now do everything in the order that you suggested and it is working.

 

Thanks also for the heads up on the log lines to look out for.

 

Cheers

 

Jon

 


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel