【问题标题】:GStreamer: Dynamically removing mixer src element freezes pipelineGStreamer:动态删除混合器 src 元素冻结管道
【发布时间】:2018-06-06 18:44:55
【问题描述】:

我正在尝试使用 gstaudiomixer 从我动态添加和删除的两个源元素中混合音频。

+---------+    +------------+
| source1 |--->|            |
+---------+    |            |    +-----------+
               | audiomixer |--->| audiosink |
+---------+    |            |    +-----------+
| source2 |--->|            |
+---------+    +------------+

动态添加元素(使用请求板和板模板)似乎可以按预期工作。 但是,当动态移除焊盘时,会导致管道冻结。

这是我用来删除元素的代码:

public void remove(Gst.Element? element)
{
    /* Removes the element from the pipeline */
    if (element == null) return;

    element.set_state(Gst.State.NULL);  // Stop it from streaming data
    element.unlink(this.mixer);
    this.pipeline.remove(element);
}

这是我第二次尝试,试图挡住垫子:

public void remove(Gst.Element? element)
{
    /* Removes the element from the pipeline */
    if (element == null) return;

    element.get_static_pad("src").get_peer().add_probe(Gst.PadProbeType.IDLE, (pad, info) => {
        element.set_state(Gst.State.NULL);  // Stop it from streaming data
        element.unlink(this.mixer);
        this.pipeline.remove(element);
        return Gst.PadProbeReturn.REMOVE;
    });
}

这样做的正确方法是什么?

【问题讨论】:

    标签: gstreamer vala


    【解决方案1】:

    如果您想从管道中更改或删除一个元素,请确保停止将缓冲区推送到该元素,向该元素发送一个 eos 并添加一个新的并继续。在link

    中有很好的解释

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多