Audio Streaming
lamco-rdp-server supports bidirectional audio via the RDPSND channel. Desktop audio is captured through PipeWire, encoded, and streamed to the connected RDP client.
Desktop audio works in 1.4.5. Every earlier release negotiated a format and built an encoder, but nothing ever started PipeWire capture, so a client negotiated sound and then heard nothing. From 1.4.5 capture starts with the session, PCM is chunked at audio.frame_ms, encoded with the negotiated codec, and delivered as RDPSND waves. Capture stops with the session, so the PipeWire thread does not leak across reconnects.
The capture target is the default sink's monitor rather than the ScreenCast video node, which is not an audio node.
Sample Rate
44.1 kHz is offered first because mstsc plays the first accepted PCM format on its native 44.1 kHz endpoint without resampling. The whole path runs at the client's rate, so pitch and sync are correct. Advertising 48 kHz first dropped pitch by about 1.5 semitones and let audio fall behind video by roughly five seconds a minute.
Supported Codecs
Codecs are auto-negotiated between the server and the RDP client during connection setup. The server advertises all available codecs, and the client selects the best match.
| Codec | Priority | Description |
|---|---|---|
| opus | Preferred | High-quality, low-latency lossy codec. Best for most connections. |
| pcm | Fallback | Uncompressed audio. Maximum quality, highest bandwidth usage. |
| adpcm | Legacy | Adaptive Differential PCM. Compatibility with older RDP clients. |
| g711 | Legacy | G.711 u-law/A-law. Telephony-grade audio for low-bandwidth links. |
Configuration
enabled = true
codec = "auto"
sample_rate = 48000
channels = 2
frame_ms = 20
opus_bitrate = 64000
| Key | Type | Default | Description |
|---|---|---|---|
| enabled | boolean | true | Enable audio streaming |
| codec | string | "auto" | Codec selection: auto, opus, pcm, adpcm, g711 |
| sample_rate | integer | 48000 | Sample rate in Hz |
| channels | integer | 2 | Number of audio channels (1 = mono, 2 = stereo) |
| frame_ms | integer | 20 | Frame size in milliseconds |
| opus_bitrate | integer | 64000 | Opus bitrate in bits per second |
How It Works
Audio requires PipeWire. The server captures desktop audio via PipeWire and encodes it for the RDP client. Codec selection is automatic via capability negotiation — the server and client exchange supported codec lists during the RDPSND channel setup, and the highest-priority mutually supported codec is selected.
Note: When codec = "auto", the server will prefer Opus if the client supports it, falling back through the priority list automatically.
Requirement: PipeWire must be running. Verify with: systemctl --user status pipewire
Opus backend build option: opus-libopus (the default, C libopus statically linked) or opus-pure-rust (mousiki, no C toolchain, slower on x86). Any build that passes --no-default-features must choose one of the two explicitly.
Roadmap: Audio is currently one-way, desktop to client. Microphone input (client to server, AUDIN) remains on the roadmap.