--- title: - QUIC with GStreamer & Rust author: - Sanchayan Maity theme: - default classoption: - aspectratio=169 --- # Who - Who am I? * Embedded Systems background * Prefer C, Haskell and Rust * Organize and speak at Rust and Haskell meet-ups in Bangalore - Work? * Software Engineer @ [asymptotic](https://asymptotic.io/) * Open source consulting firm based out of Bangalore and Toronto * Work on low level systems software centred around multimedia * GStreamer, PipeWire, PulseAudio * Language Polyglots # Open source contributions - [GStreamer](https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests?scope=all&state=all&author_username=SanchayanMaity) - [gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests?scope=all&state=all&author_username=SanchayanMaity) - [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests?scope=all&state=all&author_username=SanchayanMaity) - [PulseAudio](https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests?scope=all&state=all&author_username=SanchayanMaity) - [Linux](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=author&q=Sanchayan+Maity) - [u-boot](https://source.denx.de/u-boot/u-boot/-/commits/master?search=Sanchayan%20Maity) # Agenda - QUIC which is a UDP-Based Multiplexed and Secure Transport and standardized in RFC 9000 - Whirlwind tour of GStreamer - QUIC implementations in Rust - QUIC support in GStreamer - Demo - Future work # QUIC - QUIC is pronounced exactly like the English word "quick" - Not an acronym - Reliable and secure transport protocol - Addresses some of the known shortcomings of doing HTTP/2 over TCP and TLS - Standardized QUIC in RFC 9000 - Supported by RFC 8999, RFC 9001 and RFC 9002 # Building on shoulders of giants - HTTP/2 [RFC7540](https://www.rfc-editor.org/rfc/rfc7540) published in May 2015 - Makes use of multiplexing - Multiple logical streams over same logical connection - Better congestion control - Makes better use of TCP with bandwidth saturation - Less bandwidth consumption due to header compression # Head of line blocking[^1] ![*_HOL Blocking_*](HOL_blocking.png){width=80%} [^1]: [Head of line blocking](https://en.wikipedia.org/wiki/Head-of-line_blocking) # Protocol - Something new? - TCP? - UDP? # Security/encryption - No clear text version of the protocol - Negotiation employs cryptography and security with TLS 1.3 # QUIC - Implemented on top of UDP - Uses UDP port numbers - Implements re-transmission, congestion control among others - Logical streams similar to HTTP/2 - In-order - Reliable - Different streams can be out-of-order - Flow control - Fast handshakes (0-RTT and 1-RTT) # GStreamer - Multiplatform Pipeline based multimedia framework - Bindings for various languages - Allows building complex media processing workflows - Some applications * PiTiVi (Video Editor) * amaroK, Banshee, Clementine (audio players) * Empathy (VOIP and video conferencing) * GstLAL (gravitational wave data analysis) * Rygel (DLNA streaming server and renderer) * Totem (movie player for the GNOME desktop) # Simple pipeline ```bash gst-launch-1.0 videotestsrc ! autovideosink gst-launch-1.0 audiotestsrc ! autoaudiosink ``` # Media pipeline[^2] ![*_Simple Player_*](simple-player.png){width=80%} [^2]: [Dynamic Pipelines](https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c) # Rust implementations - [quinn-rs](https://github.com/quinn-rs/quinn) - [quiche](https://github.com/cloudflare/quiche) - [s2n-quic](https://github.com/aws/s2n-quic) - [neqo](https://github.com/mozilla/neqo) - [msquic](https://github.com/microsoft/msquic) # QUIC in GStreamer - Prior work - [gst-quic-transport](https://github.com/bbc/gst-quic-transport) - `quinnquicsink` and `quinnquicsrc` (Merged just a month ago) - Written in Rust - Uses [quinn-rs](https://github.com/quinn-rs/quinn) - New elements `quinnquicmux` and `quinnquicdemux` to support stream multiplexing # Audio demo ```bash gst-launch-1.0 -v -e audiotestsrc blocksize=4096 ! \ audio/x-raw,format=S16LE,rate=48000,channels=2,layout=interleaved ! \ opusenc ! quinnquicsink use-datagram=false secure-connection=false ``` ```bash gst-launch-1.0 -v -e audiotestsrc blocksize=4096 ! \ audio/x-raw,format=S16LE,rate=48000,channels=2,layout=interleaved ! \ opusenc ! quinnquicsink use-datagram=false secure-connection=false ``` # Video demo [quin-quic-mux](https://git.sanchayanmaity.net/sanchayanmaity/quinn-quic-mux) - Shows stream and datagram multiplexed on same connection - Merge request: [!1634](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1634) # Future work - Handling flow control - Congestion control - [RTP over QUIC](https://datatracker.ietf.org/doc/draft-ietf-avtcore-rtp-over-quic/) - [Media over QUIC](https://datatracker.ietf.org/group/moq/about/) # References - [RFC 9000](https://www.rfc-editor.org/rfc/rfc9000.html) - [Road to QUIC](https://blog.cloudflare.com/the-road-to-quic) - [0-RTT](https://blog.cloudflare.com/even-faster-connection-establishment-with-quic-0-rtt-resumption/) # Questions - Reach out on * Email: sanchayan@sanchayanmaity.net * Mastodon: [sanchayanmaity.com](https://sanchayanmaity.com/@sanchayan) * Telegram: https://t.me/SanchayanMaity * Blog: [sanchayanmaity.net](https://sanchayanmaity.net/)