合并多个分支(队列)时GStreamer如何管理线程
How does GStreamer manage threads when merging several branches (queue)
我有一个 GStreamer 管道,可以记录三个实时摄像机并基本上执行以下操作:在第一个线程中捕获 3 个摄像机;然后在 3 个单独的线程中对 3 个流进行一些处理;在其他 3 个线程中并行重新缩放 compositor(适用于实时源的视频混合器)的帧;最后做作文。每个相机的计划如下(所以 x3):
[capture] -> TEE |-> QUEUE -> [someProcessing] -> _
|-> QUEUE -> [rescale] -> COMPOSITOR
gst-launch-1.0 \
${capture0} ! tee name='t0' ! queue ! ${someProcessing0} \
${capture1} ! tee name='t1' ! queue ! ${someProcessing1} \
${capture2} ! tee name='t2' ! queue ! ${someProcessing2} \
${someStuff} \
compositor name=compo ${compositorSinkProperties} \
t0. ! queue ! ${rescale0} ! compo.sink_0 \
t1. ! queue ! ${rescale1} ! compo.sink_1 \
t2. ! queue ! ${rescale2} ! compo.sink_2 \
-e
我的管道运行良好,我只需要澄清它的内部行为:
我知道如何强制对元素 queue 使用单独的线程。但是我不知道当我的 3 个 [rescale] 分支合并到单个元素中时会发生什么,例如 compo 在我的例子中。
GStreamer是否按要求创建了3个线程?
如果是,那么 compositor 运行?
在哪个线程中执行
如果不是,我是否只有 1 个线程用于整个 缩放+合成 过程?
感谢您分享任何信息!
问候
据我所知,你是对的。您将拥有用于下游所有队列路径的线程。我 认为 聚合器也有自己的线程。我缺乏证据 - 也许你可以在 GstAggregator class.
中找到它
但是一旦聚合器上的所有接收垫都有数据,它的 aggregate
函数就会触发。
取自 base-classes 文档 here:
aggregate ()
Mandatory. Called when buffers are queued on all sinkpads. Classes should
iterate the GstElement->sinkpads and peek or steal buffers from the
GstAggregatorPads. If the subclass returns GST_FLOW_EOS, sending of the
eos event will be taken care of. Once / if a buffer has been constructed
from the aggregated buffers, the subclass should call _finish_buffer.
我有一个 GStreamer 管道,可以记录三个实时摄像机并基本上执行以下操作:在第一个线程中捕获 3 个摄像机;然后在 3 个单独的线程中对 3 个流进行一些处理;在其他 3 个线程中并行重新缩放 compositor(适用于实时源的视频混合器)的帧;最后做作文。每个相机的计划如下(所以 x3):
[capture] -> TEE |-> QUEUE -> [someProcessing] -> _
|-> QUEUE -> [rescale] -> COMPOSITOR
gst-launch-1.0 \
${capture0} ! tee name='t0' ! queue ! ${someProcessing0} \
${capture1} ! tee name='t1' ! queue ! ${someProcessing1} \
${capture2} ! tee name='t2' ! queue ! ${someProcessing2} \
${someStuff} \
compositor name=compo ${compositorSinkProperties} \
t0. ! queue ! ${rescale0} ! compo.sink_0 \
t1. ! queue ! ${rescale1} ! compo.sink_1 \
t2. ! queue ! ${rescale2} ! compo.sink_2 \
-e
我的管道运行良好,我只需要澄清它的内部行为:
我知道如何强制对元素 queue 使用单独的线程。但是我不知道当我的 3 个 [rescale] 分支合并到单个元素中时会发生什么,例如 compo 在我的例子中。
GStreamer是否按要求创建了3个线程?
如果是,那么 compositor 运行?
在哪个线程中执行
如果不是,我是否只有 1 个线程用于整个 缩放+合成 过程?
感谢您分享任何信息!
问候
据我所知,你是对的。您将拥有用于下游所有队列路径的线程。我 认为 聚合器也有自己的线程。我缺乏证据 - 也许你可以在 GstAggregator class.
中找到它但是一旦聚合器上的所有接收垫都有数据,它的 aggregate
函数就会触发。
取自 base-classes 文档 here:
aggregate ()
Mandatory. Called when buffers are queued on all sinkpads. Classes should
iterate the GstElement->sinkpads and peek or steal buffers from the
GstAggregatorPads. If the subclass returns GST_FLOW_EOS, sending of the
eos event will be taken care of. Once / if a buffer has been constructed
from the aggregated buffers, the subclass should call _finish_buffer.