Skip to content

Say the --audio-format pin missed the advertisement, not the device - #38

Merged
chrisuthe merged 1 commit into
mainfrom
chrisuthe/task/reword-the-audio-format-refusal-to-name-the
Aug 28, 2026
Merged

chrisuthe merged 1 commit into
mainfrom
chrisuthe/task/reword-the-audio-format-refusal-to-name-the

Conversation

@chrisuthe

Copy link
Copy Markdown
Member

Closes #37.

--audio-format refused a pin the advertised list does not carry with a message
that blamed the output device:

E audio: --audio-format asked for FLAC 1ch 16-bit @ 48000 Hz, which output device 'null' does
not take -- refusing to start rather than play something else. Run with -l to see what the
device accepts.

The device takes it. advertised_channels() collapses the channels axis to a
single count — 2 where the device lists it, its narrowest otherwise — while rate
and depth are crossed across everything reported. So the advertisement carries one
channel count and only one, and any pin naming another misses
pin_preferred_format() whether or not the device reports that width.

The advice compounded it: -l prints the device's own channel list, so an operator
who followed it was shown channels: 1 2 — a set that confirms their pin — and told
the opposite.

Reproduces with no hardware, on null, stdout, pulse and pipewire (all report
SinkCapabilities::permissive()), and on ALSA or PortAudio devices that cannot be
probed.

What this does

Rewords the refusal to assert only what was actually checked — membership in the
advertisement — and keeps the -l pointer with the distinction spelled out:

E audio: --audio-format asked for FLAC 1ch 16-bit @ 48000 Hz, which is not among the formats
advertised for output device 'null' -- refusing to start rather than play something else. Run
with -l to see what the device itself reports -- not the same set as what gets advertised.

"Not the same set" rather than "a wider set", deliberately. The advertisement is
not simply a subset of what -l shows: a device reporting only stereo yields
identical sets; the permissive-fallback path (device reported nothing emittable)
advertises more than -l prints; and Opus is only ever advertised at
48 kHz / 16-bit / ≤2ch whatever the device reports.

No behaviour change. advertised_channels(), supported_formats(),
pin_preferred_format() and the preference ladders are untouched, and the
Advertising N formats … line is byte-identical. The refusal stays — refusing
rather than playing something else is the whole point of the flag.

The same wrong claim appeared in six other places, all corrected: the --help
text, the packaged conf example, README.md, docs/wiki/Configuration.md,
ROADMAP item 24 (both bullets — the second still said "startup-time device
validation"), and the doc-comments that own the flag in src/cli.h and
src/supported_formats.h. The README also now states that the advertisement
carries a single channel count, so a reader whose mono pin was just refused can
work out why.

Left alone on purpose: the runtime refusal in src/player_listener.cpp, where the
device genuinely did refuse, so "what the device accepts" is true there.

Verification

$ sendspin-cli -o null --audio-format flac:48000:16:1 --no-mdns --no-control
I audio: Advertising 65 formats for 'null': FLAC 2ch 16/24/32/8-bit @ 48000/44100/96000/88200/192000/176400/32000/22050 Hz; OPUS 2ch 16-bit @ 48000 Hz; PCM 2ch 16/24/32/8-bit @ 48000/44100/96000/88200/192000/176400/32000/22050 Hz
E audio: --audio-format asked for FLAC 1ch 16-bit @ 48000 Hz, which is not among the formats advertised for output device 'null' -- refusing to start rather than play something else. Run with -l to see what the device itself reports -- not the same set as what gets advertised.
$ echo $?
1

Still starts on a pin the advertisement carries:

$ sendspin-cli -o null --audio-format flac:48000:16:2 --no-mdns --no-control
I audio: Preferred format pinned first: FLAC 2ch 16-bit @ 48000 Hz

A pin outside the probed axes is refused by the same message (flac:11025:16:2,
exit 1) — the rate-miss and channel-miss cases share one path.

ctest: 401/401 pass, with no new or changed test expectations. clang-format
clean over every changed region.

Not in scope

Whether the channels narrowing itself should go — advertising every count the
device reported — is a behaviour change with its own argument and is deliberately
not made here. It is worth its own issue if a mono or multichannel pin should ever
work. Note that advertised_channels()'s rationale argues against promising a
width the device cannot take, which says nothing about why the narrower widths it
can take are dropped.

A pin the advertised list does not carry was reported as a format the
output device does not take. The device often takes it: advertised_channels()
collapses the channels axis to a single count -- 2 where the device lists it,
its narrowest otherwise -- so a mono or multichannel pin misses
pin_preferred_format() on any device that also takes stereo, and the refusal
blamed the device for a narrowing this player did.

The advice compounded it. -l prints the device's own channel list, so an
operator who followed it was shown a set that confirmed their pin and told
the opposite.

Reword the refusal to assert only what was checked -- membership in the
advertisement -- and keep the -l pointer with the distinction spelled out.
The refusal itself is unchanged: refusing rather than playing something else
is what the flag is for. advertised_channels(), supported_formats(),
pin_preferred_format() and the preference ladders are untouched.

The same claim appears in --help, the packaged conf example, the README, the
Configuration wiki page, ROADMAP item 24, and the doc-comments that own the
flag in cli.h and supported_formats.h. Correct each.
@chrisuthe
chrisuthe marked this pull request as ready for review August 28, 2026 13:28
@chrisuthe
chrisuthe merged commit 7f33e4d into main Aug 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--audio-format blames the device for a pin the advertisement does not carry

1 participant