Skip to main content

## clamp_max_audio_channels

# Function clamp_max_audio_channels

Source

    pub fn clamp_max_audio_channels(reported: Option<u32>) -> u32

Expand description

Decide the `MaxAudioChannels` to advertise, given what the current audio route reported.

Without this constraint Jellyfin is free to direct-play a 5.1 or 7.1 track to a sink that only has two channels. What the user hears then is device dependent and rarely correct — a failed `AudioSink` configuration (silence), or centre-channel dialogue folded away to near-inaudibility. Naming the real channel count makes the server downmix instead, which is always audible.

A missing or zero reading means “route not established yet”, not “no audio”: fall back to stereo rather than claiming a capability we have not seen.

TRACES: UR-004 | DR-141 | UT-141