Posts

GStreamer RTP Session Handling in Rust

Recently we at Centricular had the opportunity to write some new GStreamer RTP elements in Rust as part of a grant from the Sovereign Tech Fund . We of course jumped at the chance. The existing RTP elements are all currently written in the C programming language and have been around for over a decade. The age is showing somewhat with some of the architecture decisions and user visible interfaces. There is also a general desire within the GStreamer community to write parsers and other elements handling potentially untrusted data in a much more memory safe language, like Rust. As a bonus, Rust comes with better tooling out of the box for developers than C/C++. In this blog post we will be looking into how RTP sessions are managed in GStreamer, independent of the specifics of a particular RTP payload format. The Prior Art: rtpbin In GStreamer, the pre-existing interface for handling RTP sessions is managed by the rtpbin element. The rtpbin element is over 15 years old and ha

New Qt6 QML (OpenGL) elements

Image
Recently, I was tasked with porting some of the existing Qt5-based QML GStreamer elements for use with Qt6. Throughout this process, the only major architectural change in Qt that affected these GStreamer elements was the Qt6 rendering overhaul for supporting multiple graphics APIs (OpenGL, Vulkan, Direct3D, Metal, etc). The process overall was relatively painless however still required understanding the new Qt6 rendering model. The result is a set of elements that mirror functionality of the existing Qt5 GStreamer elements (`qmlglsink`, `qmlglsrc`, `qmlgloverlay`). The new elements are named `qml6glsink`, `qml6glsrc`, and `qml6gloverlay`. There is also a new element called `qml6glmixer`. qml6glsink The Qt6 variant of qmlglsink operates the exact same as its Qt5 counterpart. There is a QML Item that needs to be retrieved from the QML scene and a GStreamer sink component that needs the QML item set as a property. Once that is achieved, the video stream is viewable in the QML sc

GStreamer WebRTC in 2020

A little while ago, we at Centricular developed a plugin for easier WebRTC with GStreamer . For the details on the initial release, see Nirbheek 's blogpost about the new GStreamer WebRTC implementation. The initial release gathered a lot of interest and sparked a fair bit of activity around some of the needed features. This is a birds eye view of the new features since Nirbheek's blog post. New features RTP Bundling In a WebRTC connection there may be multiple streams that need to be sent and received. Without bundling, they would require opening a connection for each stream to be sent (and another for some control packets if not muxing RTCP with the RTP stream). This may consume precious ports and TURN resources if relaying is in use with the network topology. A WebRTC stream with bundling will instead send all of the streams over a single connection. GStreamer already supported bundling of streams as required by the WebRTC and related specifications and an im

qmlglsink - GStreamer and Qt's QML

Windows Support - NEW!! Just recently, I added the missing piece for adding Windows support for qmlglsink for QtQuick 2 applications (tracked by this bug ) with this commit which means that qmlglsink is now usable on all major platforms 1 . With the list of supported platforms (Android, iOS, OS X, Windows, Linux) for qmlglsink growing, I thought I'd write a little bit about it and why you should use it. qmlglsink is a GStreamer element that will render a video stream into a QtQuick QML scene. As you can see from this example , qmlglsink does this by providing a GstGLVideoItem QML item that can be placed anywhere in the scene. The GstGLVideoItem is given a unique name to be able to link the element and the QML item. Without this link, the element cannot render the stream anywhere and will fail changing state. In the C++ code, we then retrieve the GstGLVideoItem by name like so . Then we set the pipeline to playing, start Qt's mainloop and watch the show. Why Use qml

Vulkan in GStreamer

Image
Today, Vulkan 1.0 as released . For those of you that don't what Vulkan is, the TL;DR is essentially that it's cross-platform/device lower level 3D API than OpenGL (both the desktop and the ES variants) of a similar scope to DX12, Metal or Mantle. As a result, the driver does less work and the application/engine takes over some of the management of resources which hopefully leads to a smaller driver divergence and therefore bugs while at the same time providing increased access to the capabilities of the GPU. Centricular graciously sponsored some of my time to have a look at Vulkan and implement a basic working prototype of a GStreamer sink element that would display video frames onto the screen. I hereby present to you, vulkansink, the result of that labour. gst-launch-1.0 videotestsrc ! vulkanupload ! vulkansink Disclaimer: this is still alpha-quality code and it hasn't had the same extensive testing as the OpenGL elements and there are a number of short fall

GStreamer 1.6 and OpenGL contexts

With the imminent release of GStreamer 1.6 there has been a change in the mechanism by which OpenGL contexts and Window System (X11, Wayland, Win32, OS X's Cocoa) specific resources are shared with a GStreamer pipeline for elements that need that information. Elements like sinks or any of the GL elements or any global application provided information that is shared between elements. Previously, in 1.4, there was a property, 'external-opengl-context' available on some(!) elements that one could set on the current set of filter and mixer elements (not sink or source elements though!). While it mostly worked well enough, it was a behaviour difference to how window system handles are shared between the application and the GStreamer pipeline. Internal GL context sharing between elements was occurring in the ALLOCATION query as a value in a GstStructure of the meta:GstVideoGLTextureUploadMeta parameters. The main problem with this is 1. the ALLOCATION query is handled diffe

GNOME Asia 2015

Image
I've just arrived back from GNOME Asia and it's time to blog about the experience there. The trip to Jakarta was relatively uneventful. An early train to Sydney started the day followed by the trip to Singapore. A tight connection (1 hour) combined with switching terminals made life a little interesting. The fact that one of the Changi terminal connection AirTrain's was out of service meant we were bussed across the tarmac. Then to find the gate and the aeroplane, and the short trip to Jakarta. After landing in Jakarta, I was meant to meet up with a local Indonesian, however different terminal exit points meant that we missed each other and a phone call was necessary on another local's mobile phone. After meeting there was a bus trip followed by a KRL (train) trip followed by a ride on a Ojek (motorcycle) which made for an interesting trip to my sleeping quarters. A local meal was followed swiftly by some horizontal time. Some early breakfast consisting of