首页 > 解决方案 > Gstreamer 不在 Ubuntu 18.04 VM 上发送“准备窗口句柄”消息

问题描述

我正在尝试开发 python 应用程序,它显示接收到的 UDP 流 insige QWidget 窗口。我使用 gstreamer 和 Pyside (Qt)。为此,我需要使用我的 QWidget 的 winId 设置窗口句柄,我这样做了。下面的代码示例:

def _on_any_bus_message(self, bus, message):
    structure = message.get_structure()
    if structure is not None:
        print(structure.get_name())
        if structure.get_name() == "prepare-window-handle":
            message.src.set_window_handle(self.videoWidget.winId())
    return Gst.BusSyncReply.PASS

videoWidget是类型QWidget

当我在 Ubuntu 18.04 VM 中运行我的应用程序并尝试接收流时,它会在新的 OpenGL 渲染器窗口而不是预期的窗口中打开。我在上面的代码中打印了传入的消息,并注意到"prepare-window-handle"从未收到消息。

我做了另一项测试——我在 Docker 容器中使用 Ubuntu 16.04 运行相同的应用程序并"prepare-window-handle"收到了消息——它在终端中打印并由应用程序处理。

两台 linux 机器都安装了 gstreamer1.0 和相同的插件集。在 Linux VM 上未收到此消息的原因可能是什么?它与图形驱动程序或某些加速问题有关吗?

标签: pythonlinuxqtgstreamerpyside

解决方案


感谢弗洛里安的问题,我将我的调查引向了一个好的方向,并找到了我的问题的解决方案 - gstreamer 接收管道需要autovideosink更改为ximagesink. 完整的工作管道发布在下面:

udpsrc port=4000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtpjitterbuffer ! rtph264depay ! decodebin ! videoconvert ! ximagesink sync=FALSE


推荐阅读