简体   繁体   English

包含两个接收器的Tee的GStreamer管道失败

[英]GStreamer pipeline with Tee including two sink fails

Trying to implement GStreamer pipeline with Tee using following elements. 尝试使用以下元素通过Tee实现GStreamer管道。

gst_bin_add_many(GST_BIN (pipeline), <rpicamsrc>, <capsfilter>, <h264parse>, tee, <queue>, <rtph264pay>, <fakesink>, <queue>, <avdec_h264>, <videoconvert>, <capsfilter>, <customplugin>, <fakesink>, nullptr);

For better understanding provided the element names. 为了更好地理解,提供了元素名称。 The purpose is to create Tee pipeline as follows: 目的是创建Tee管道,如下所示:

rpicamsrc ! capsfilter ! h264parse ! tee name=t t. ! queue ! rtph264pay ! fakesink t. ! queue ! avdec_h264 ! videoconvert ! capsfilter ! customplugin ! fakesink

But it fails always and doesn't report any error. 但是它总是失败,并且不报告任何错误。 But no video frames are captured. 但是没有捕获视频帧。 After some testing identified that fails for even this simple pipeline: 经过一些测试,即使对于这个简单的管道也失败了:

gst_element_link_many ( <rpicamsrc>, <capsfilter>, <h264parse>, <rtph264pay>, <fakesink>, nullptr))

Interesting is if I remove second fakesink from that above gst_bin_add_many line of code it works. 有趣的是,如果我从gst_bin_add_many代码行上方的第二个假冒池中删除了它, 那么它就可以工作。 Not sure what's the problem with this. 不知道这是什么问题。 Tried to use a different sink like autovideosink but no luck. 试图使用不同的接收器,例如autovideosink,但没有运气。 When it fails it doesn't receive GST message type GST_MESSAGE_ASYNC_DONE in gst bus, but for success case it does. 当它失败时,它不会在gst总线上收到GST消息类型GST_MESSAGE_ASYNC_DONE ,但对于成功的情况,它将成功。 Gets GST_STREAM_STATUS_TYPE_CREATE , GST_STREAM_STATUS_TYPE_ENTER and GST_MESSAGE_STREAM_START for both failure and success case. 对于失败和成功案例,均获取GST_STREAM_STATUS_TYPE_CREATEGST_STREAM_STATUS_TYPE_ENTERGST_MESSAGE_STREAM_START What I am doing wrong, any ideas? 我做错了,有什么想法吗?

gst_element_link_many() is a convenient wrapper for a non-branched pipeline, meaning that it links one from next, to next. gst_element_link_many()是非分支管道的便捷包装,这意味着它将一个从下一个链接到另一个。 It does not know that you want to link the tee element in the middle of the pipeline with multiple elements. 它不知道您想将管道中间的tee元素与多个元素链接起来。 For example in your case, it tries to connect the fakesink to the queue in the middle of your pipeline. 例如,在您的情况下,它尝试将fakesink连接到管道中间的queue

Easy way 简单的方法

You can use gst_parse_launch() to let GStreamer figure out what links to what. 您可以使用gst_parse_launch()让GStreamer找出链接到什么的链接。

By your hands 用你的双手

If you have an element like tee , you must use gst_element_link() or gst_element_link_pads() to tell GSreamer that which element connect to which. 如果您有类似tee的元素,则必须使用gst_element_link()gst_element_link_pads()来告知GSreamer哪个元素与哪个元素相连。

It is possible to create two pipelines with gst_element_link_many() , 可以使用gst_element_link_many()创建两个管道,

rpicamsrc → capsfilter → h264parse → tee → queue → rtph264pay → fakesink

queue → avdec_h264 → videoconvert → capsfilter → customplugin→ fakesink

and then, link the tee element in the above to the below with gst_element_link_pads() . 然后,使用gst_element_link_pads()将上方的tee元素链接至下方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM