Audio Subsystem

August 16, 2026 ยท View on GitHub

For usage related information, see audio feature.

The prefix for all packets and capabilities is audio.

ComponentLink
clientxpra.client.subsystem.audio
client connectionxpra.server.source.audio
serverxpra.server.subsystem.audio

xpra.audio contains the components used for capturing and playing back audio streams using GStreamer.
In order to avoid interfering with the performance of the main thread, all audio processing is done in a separate process.
For historical reasons, this is done using a subprocess wrapper rather than the builtin multiprocessing module.

Pulseaudio

xpra.audio.pulseaudio is often used for playback on Linux systems.
This is also the prefered backend for audio capture in server sessions. The xpra server will usually start a pulseaudio instance hidden away in a per-session user prefix so that multiple sessions can forward audio streams independently.

The client and server should expose the following capabilities in their hello packet with the audio prefix:

CapabilityTypePurpose
decodersList of stringsThe audio formats that can be received and decoded
encodersList of stringsThe audio formats that can be encoded and sent
sendbooleanIf sending audio is enabled
receivebooleanIf receiving audio is enabled

The lists of decoders and encoders contain strings such as: mp3, opus+ogg, vorbis...
You can run xpra.audio.gstreamer_util to see which encoders and decoders are available on the system.

This protocol is identical in both directions. Audio being forwarded from the server to the client (aka "speaker forwarding") uses the same packets as audio coming from the client to the server (aka "microphone forwarding").

Packet TypeArgumentsPurposeInformation
audio-datacodec : string
data : bytes
attributes : dictionary
Audio stream dataThe initial and final packets may omit the data argument and should set the start-of-stream / end-of-stream attributes
audio-controlsubcommand : string
(ie: start, stop, sync, new-sequence)
argument : Any
Send a request to the peer
audio-capabilitiescapabilities dictionaryUpdate audio formats and directionsSent when asynchronous audio capability discovery completes
audio-keepalivemonotonic timestampKeep an active stream aliveEither direction
audio-levelsample dictionaryPublish meter valuesServer to client when requested
audio-signalbooleanPublish whether a non-silent signal is presentServer to client when requested