ironrdp-rdpsnd crate implements the RDPSND static virtual channel for audio output redirection as specified in MS-RDPEA. This channel enables playback of remote audio on the local machine.
Overview
The RDPSND channel handles audio format negotiation, volume control, and streaming audio data from server to client. It supports multiple audio formats including PCM, ADPCM, and OPUS.Architecture
The crate provides both client and server implementations:- Client (
clientmodule): Receives and plays audio from remote server - Server (
servermodule): Sends audio to remote client
Client API
Rdpsnd
The client-side RDPSND processor.ironrdp-rdpsnd/src/client.rs:58
RdpsndClientHandler
Trait for handling audio output operations:ironrdp-rdpsnd/src/client.rs:13
Methods:
get_flags()- Returns supported capability flags (e.g.,VOLUME,PITCH)get_formats()- Returns list of supported audio formatswave()- Called when audio data arrives for playbackset_volume()- Called when volume change is requestedset_pitch()- Called when pitch change is requestedclose()- Called when audio channel is closed
Server API
RdpsndServer
The server-side RDPSND processor.ironrdp-rdpsnd/src/server.rs:50
Key Methods:
wave(data: Vec<u8>, ts: u32)- Sends audio data to clientset_volume(volume_left: u16, volume_right: u16)- Sets client volumeclose()- Closes the audio channel
RdpsndServerHandler
Trait for handling server-side audio operations:ironrdp-rdpsnd/src/server.rs:31
Audio Formats
Usage Examples
Client Implementation
Server Implementation
Protocol Flow
Initialization (Client)
- Server sends
ServerAudioFormatPduwith supported formats - Client responds with
ClientAudioFormatPducontaining intersected formats - If version >= V6, client sends
QualityModePdu - Server sends
TrainingPduwith test audio - Client responds with
TrainingConfirmPdu - Channel enters
Readystate
Audio Streaming
- Server sends
Wave2Pdu(v8+) orWavePdu(v7-) with audio data - Client handler receives data via
wave()callback - Client sends
WaveConfirmPduto acknowledge receipt - Server continues streaming subsequent blocks
Version-Specific Behavior
- Version 2-5: Basic audio streaming
- Version 6+: Adds quality mode support
- Version 8+: Uses
Wave2Pduformat with audio timestamp
PDU Types
Key protocol data units:ServerAudioFormatPdu- Server’s supported audio formatsClientAudioFormatPdu- Client’s supported audio formatsWavePdu/Wave2Pdu- Audio data packetsWaveConfirmPdu- Acknowledgment from clientTrainingPdu/TrainingConfirmPdu- Audio latency testingVolumePdu- Volume controlPitchPdu- Pitch controlQualityModePdu- Audio quality settings
Quality Modes
Related Crates
- ironrdp-rdpsnd-native: Platform-specific audio output implementations
- ironrdp-svc: Static virtual channel infrastructure
- ironrdp-pdu: Protocol data unit encoding/decoding

