Sharing Pipeline Between Two Threads

Dwight Kulkarni dwight at realtime-7.com
Mon Sep 13 14:21:50 UTC 2021


Hi all,

I have a gstreamer pipeline that I initialize on thread #1 like so:

gst_init (0, NULL);

string pipeline = "v4l2src device=/dev/video1 ! video/x-raw, width=1920,
height=1080, framerate=15/1 ! vpuenc_h264 ! tee name=v ! queue ! h264parse
! appsink name=h264vid max-buffers=1 drop=true v. ! queue ! h264parse !
splitmuxsink name=filesink location=./videos/video%02d.mkv
max-size-time=10000000000 muxer-properties=\"properties,streamable=true\"";

gstreamer_main_video_pipeline = gst_parse_launch(pipeline.c_str(),NULL);
gst_element_set_state (gstreamer_main_video_pipeline, GST_STATE_PLAYING);



On  a second thread I am trying to run an rtsp server. I was able to get
the RTSP server working from media_configure to run the exact pipeline as
above.

If I initialize the pipeline in the local method: media_configure it works,
but if I pass the pointer to the pipeline from the other thread it doesn't
work.

for example this works:

ctx->generator_pipe = gst_parse_launch(pipeline.c_str(),NULL);

this doesn't work:

ctx->generator_pipe = get_gstreamer_pipeline();

I know that the pipeline is playing because I can see the files being
outputted but I can't see the VLC client video if I pass the pointer from
the other thread. If I call gst_parse_launch on the same thread then it
works.

Is there a way to share a pipeline between two threads ?

-- 
Sincerely,

Dwight Kulkarni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210913/6ad02e2a/attachment.htm>


More information about the gstreamer-devel mailing list