Gstreamer 不在 Ubuntu 18.04 VM 上发送 'prepare-window-handle' 消息
Gstreamer doesn't send 'prepare-window-handle' message on Ubuntu 18.04 VM
我正在尝试开发 python 应用程序,它在 QWidget window 中显示接收到的 UDP 流。我使用 gstreamer 和 Pyside (Qt)。为此,我需要使用我的 QWidget 的 winId 设置 window 句柄,我这样做了。下面的代码示例:
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 渲染器 window 中打开,而不是预期的 window。我在上面的代码中打印了传入消息,并注意到从未收到消息 "prepare-window-handle"
。
我做了另一个测试 - 我 运行 在 docker 容器中使用 Ubuntu 16.04 的同一个应用程序并且收到消息 "prepare-window-handle"
- 它在终端打印并且由应用程序处理。
两台 linux 机器都安装了带有相同插件集的 gstreamer1.0。在 Linux VM 上未收到此消息的原因可能是什么?是不是跟显卡驱动或者加速问题有关?
多亏了 Florian 的提问,我的调查有了一个好的方向,并找到了解决我的问题的方法 - gstreamer 接收管道需要 autovideosink
更改为 ximagesink
。下面发布了完整的工作流水线:
udpsrc port=4000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtpjitterbuffer ! rtph264depay ! decodebin ! videoconvert ! ximagesink sync=FALSE
我正在尝试开发 python 应用程序,它在 QWidget window 中显示接收到的 UDP 流。我使用 gstreamer 和 Pyside (Qt)。为此,我需要使用我的 QWidget 的 winId 设置 window 句柄,我这样做了。下面的代码示例:
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 渲染器 window 中打开,而不是预期的 window。我在上面的代码中打印了传入消息,并注意到从未收到消息 "prepare-window-handle"
。
我做了另一个测试 - 我 运行 在 docker 容器中使用 Ubuntu 16.04 的同一个应用程序并且收到消息 "prepare-window-handle"
- 它在终端打印并且由应用程序处理。
两台 linux 机器都安装了带有相同插件集的 gstreamer1.0。在 Linux VM 上未收到此消息的原因可能是什么?是不是跟显卡驱动或者加速问题有关?
多亏了 Florian 的提问,我的调查有了一个好的方向,并找到了解决我的问题的方法 - gstreamer 接收管道需要 autovideosink
更改为 ximagesink
。下面发布了完整的工作流水线:
udpsrc port=4000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtpjitterbuffer ! rtph264depay ! decodebin ! videoconvert ! ximagesink sync=FALSE