ADR-0018: Mirror media pipeline on the desktop: GStreamer with a statically linked GTK4 sink
- Status: accepted
- Date: 2026-11-15
- Deciders: maintainer, after the M4 research round (
docs/notes/m4-research-desktop.md) - Tags:
linux,gtk,packaging
Context
The mirror window must decode H.264 from a socket and show it in a GTK4
widget with low latency, from one .deb that installs on Ubuntu 24.04,
Linux Mint 22 and Debian 13. gtk4paintablesink is packaged only on
Debian 13. libavcodec’s soname differs between Ubuntu 24.04 and Debian 13.
Decision
- GStreamer through gstreamer-rs, with
gst-plugin-gtk4linked statically into thetetherbinary (the release line matching our gtk4 bindings). Pipeline:appsrc ! h264parse ! <decoder> ! glsinkbin (gtk4paintablesink), live, unsynchronised, late frames dropped. Decoder picked at run time:vah264dec,nvh264dec, thenavdec_h264,openh264dec. - The GTK app reads the mirror connection it receives as a file
descriptor from the daemon (
StartMirror) and writes input events to it. - Phone audio (M4.2) is decoded in the daemon with GStreamer
(
appsrc ! opusdec ! audioconvert ! audioresample ! pulsesink), so it plays without the window. - Webcam (M4.3):
v4l2sinkinto v4l2loopback with guided module set-up; a PipeWire camera node as an optional second output. - Packaging: build-depends
libgstreamer1.0-dev,libgstreamer-plugins-base1.0-dev; the.debdepends ongstreamer1.0-plugins-base,-good,-gland recommendsgstreamer1.0-plugins-bad,gstreamer1.0-libav. The mirror code sits behind the cargo featuremirror(default on) so the app still builds without the GStreamer headers.
Consequences
Positive
- One binary across the target distributions; hardware decode where the system has it.
Negative / risks
- Larger binary and a longer build.
- Software decode may add frames of delay; to be measured against the 100 ms target.
- VA-API and the Wayland dmabuf path cannot be tested on the author’s NVIDIA machine.
Alternatives considered
- ffmpeg bindings with our own texture upload: soname mismatch across the target distributions.
- Depending on a packaged
gstreamer1.0-gtk4: absent on Ubuntu 24.04 and Mint 22.