Skip to content

Require source clients to always report signal - #335

Merged
kahrendt merged 2 commits into
mainfrom
feat/required-source-signal
Oct 28, 2026
Merged

kahrendt merged 2 commits into
mainfrom
feat/required-source-signal

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

signal was optional and only described line sensing, so a server could not offer automatic playback for sources without it and had to explain to users why the option was missing.

Every source now reports signal. present means the source has input audio to offer, set from a user action like a button or a sharing toggle, from detecting audio on its input, or both. Only a source fed through an audio-only connection, like an analog line-in, should detect it from the audio, so a microphone never has to listen all the time. This removes the line_sense flag and with it the client's source@v1_support object.

The server now reacts to changes of signal, so a turntable that keeps playing after the user stopped its stream does not restart it. The first signal after activation, or after the client becomes available again, counts as a change.

Implementation guide

A follow-up to the implementation guide will cover:

  • Suggested threshold, hold time and algorithm for detecting audio on a line-in
  • How each kind of source decides signal (Bluetooth receivers, desktop apps, HDMI and S/PDIF inputs, microphones)
  • How a momentary button maps to signal, and what the device shows while it waits for the server

These stay out of the spec, since good values depend on the hardware, no compliance test can check them, and implementations should be able to improve on them without a spec change.

Limitations

  • A server can't tell a source that can't detect audio apart from one with nothing playing, since both report absent.
  • signal can't stop the server from starting a source. Declining a start is handled separately in Let a source decline a start #334.

Breaking changes

  • Clients: must always send signal in the source state, and must no longer send source@v1_support in client/hello.

  • Servers: must not require source@v1_support from clients. A server that still requires it won't activate the source role for updated clients.

  • Servers: should treat signal changes as start and stop hints, not the current value.

  • I accept the Contributor License Agreement for this contribution.

@kahrendt kahrendt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kahrendt
kahrendt merged commit 73b674b into main Oct 28, 2026
1 check passed
@kahrendt
kahrendt deleted the feat/required-source-signal branch October 28, 2026 11:10
kahrendt added a commit to esphome/esphome that referenced this pull request Oct 28, 2026
Follows Sendspin/spec#335, where every source reports whether it has audio to offer. sendspin-cpp
0.9.3 reports the signal only with line sense on, so the hub always turns that on and applies the
signal in setup(). The build test sets the signal from a sharing switch instead of the stream
automations, since the server takes signal changes as start and stop hints.
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Nov 16, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

Source clients that follow the updated spec no longer send
`source@v1_support`, but the server still required it. A strict server
rejected them and a lenient one never activated their source role, so
their `signal` never reached the application.

The server now activates the role without it and reports every `signal`
change through `SourceSignalChangedEvent`, including the first one after
the client becomes available again. An older client's
`source@v1_support` still parses, so its `line_sense` keeps working, but
it's flagged as noncompliant, like a source state without `signal`. A
strict server therefore rejects source clients built on older
aiosendspin releases.

A `client-stream/end` with no input stream open now counts as a declined
start, so it no longer authorizes a later `client-stream/start`.

**Related issue or spec PR (if applicable):**

- Sendspin/spec#335
- Sendspin/spec#334

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [x] Bugfix (non-breaking change which fixes an issue): `bugfix`
- [ ] New feature (non-breaking change which adds functionality):
`new-feature`
- [ ] Enhancement to an existing feature: `enhancement`
- [ ] Breaking change (changes the public API or the protocol in a way
that is not backwards compatible): `breaking-change`
- [ ] Refactor (no behavior change): `refactor`
- [ ] Documentation only: `documentation`
- [ ] Maintenance / chore: `maintenance`
- [ ] CI / workflow change: `ci`
- [ ] Dependencies bump: `dependencies`
maximmaxim345 added a commit to Sendspin/aiosendspin that referenced this pull request Nov 16, 2026
# What does this implement/fix?

<!-- Quick description and explanation of changes. -->

The client SDK now follows the updated source spec. It no longer sends
`source@v1_support`, and every `client/state` source object carries
`signal`, which starts at `absent` until the app reports otherwise.

This removes the `source_support` argument and property from
`SendspinClient`, and `send_source_signal()` no longer requires
`line_sense`. Source clients built on this need a server that includes
#614, since older servers don't activate their source role.

Requires #614

**Related issue or spec PR (if applicable):**

- Sendspin/spec#335

## Types of changes

<!--
Tick exactly one box. CI (.github/workflows/pr-labels.yaml) applies the
matching label, and the release notes use it to sort this change.
-->

- [ ] Bugfix (non-breaking change which fixes an issue): `bugfix`
- [ ] New feature (non-breaking change which adds functionality):
`new-feature`
- [ ] Enhancement to an existing feature: `enhancement`
- [x] Breaking change (changes the public API or the protocol in a way
that is not backwards compatible): `breaking-change`
- [ ] Refactor (no behavior change): `refactor`
- [ ] Documentation only: `documentation`
- [ ] Maintenance / chore: `maintenance`
- [ ] CI / workflow change: `ci`
- [ ] Dependencies bump: `dependencies`
meiser79 added a commit to meiser79/sendspin-cpp that referenced this pull request Nov 26, 2026
roles/source/v1.md now requires `signal` in every client/state source
object and no longer has a line_sense feature (Sendspin/spec#335). The
role sends an empty source@v1 support object, set_signal() is always
taken, and the signal is ABSENT until one is set, so a source that
detects nothing never hints a start. SourceRoleConfig::line_sense is
gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/sendspin-cpp that referenced this pull request Nov 26, 2026
roles/source/v1.md now requires `signal` in every client/state source
object and no longer has a line_sense feature (Sendspin/spec#335). The
role sends an empty source@v1 support object, set_signal() is always
taken, and the signal is ABSENT until one is set, so a source that
detects nothing never hints a start. SourceRoleConfig::line_sense is
gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/sendspin-cpp-cli that referenced this pull request Nov 26, 2026
Sendspin/spec#335 makes `signal` required in every source state and drops
the line_sense hello feature. Built against a sendspin-cpp that always
reports it, absent until set: without the flag the input now reports
absent, so a server never starts it on its own. With the flag it is
detected as before.

--line-sense becomes --signal-threshold (signal-threshold in a config
file), since it is the level above which the input counts as carrying
the spec's signal; line_sense.{h,cpp} become signal_detector.{h,cpp}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/sendspin-cpp-cli that referenced this pull request Nov 26, 2026
Every source state carries the spec's `signal` (Sendspin/spec#335): with
--signal-threshold <dBFS> it is present or absent from the input's RMS
level, so a server can start and stop the input on its own; without it
the input reports absent, so a server never starts it unasked. Present
after 500 ms above the level, absent after 5 s below it. The capture
device stays open while idle so the level can be read; audio reaches the
role only while the server streams it. status shows the state on the
input line.

Builds against a sendspin-cpp fork commit that always reports the signal
until that is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/local-audio-addon that referenced this pull request Nov 26, 2026
The player's --line-sense became --signal-threshold, now that every
source reports the spec's `signal` and line_sense is gone from it
(Sendspin/spec#335). SENDSPIN_LINE_SENSE becomes
SENDSPIN_SIGNAL_THRESHOLD, the line_sense app option signal_threshold
and its label Signal threshold; none of them was released. Without it
the input now reports no signal rather than none at all.

Builds sendspin-cli from the fork's squashed feature/input-metadata.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/server that referenced this pull request Nov 26, 2026
Sendspin/spec#335 dropped the line_sense hello feature: every source
client now reports `signal` in its state, and one that detects nothing
reports it absent. Line-in autostart is therefore offered to every
source rather than only to those advertising line_sense, and the "not
supported" note goes. The demo device stops passing source_support,
which the 11.0 client SDK builds itself.

The test zeroconf mock returns an awaitable from the service calls, as
the real ones do; 11.0 awaits that too.

Pins aiosendspin to the fork's feature/source-metadata branch, 11.0.0
plus source metadata, until that is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/server that referenced this pull request Nov 26, 2026
Sendspin/spec#335 dropped the line_sense hello feature: every source
client now reports `signal` in its state, and one that detects nothing
reports it absent. Since aiosendspin 11.0.0 the setting is offered to
every source rather than only to those advertising line_sense, and the
"not supported" note goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/sendspin-cpp that referenced this pull request Nov 26, 2026
roles/source/v1.md now requires `signal` in every client/state source
object and no longer has a line_sense feature (Sendspin/spec#335), and
client/hello no longer defines a source@v1 support object. The role
sends none, set_signal() is always taken, and the signal is ABSENT until
one is set, so a source that detects nothing never hints a start.
SourceRoleConfig::line_sense is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/sendspin-cpp-cli that referenced this pull request Nov 28, 2026
Pin the fork commit of Sendspin/sendspin-cpp#287, which only drops the
client's source@v1_support and always reports the source signal
(Sendspin/spec#335), instead of a commit that also carries
SourceRole::set_metadata(), which this branch does not use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/pipewire-module-sendspin that referenced this pull request Nov 28, 2026
sendspin-cpp f49a5bf still sends the client's source@v1_support, which
Sendspin/spec#335 removed and aiosendspin 11.0.0 flags as non-compliant.
The submodule and the FetchContent fallback now use 96e002d from
meiser79/sendspin-cpp, the commit of Sendspin/sendspin-cpp#287, until
that is in a release. It drops SourceRoleConfig::line_sense: the source
signal is always reported, ABSENT until the module's line-sense sets it.

A shallow clone cannot check out a commit hash, so the fallback clones
in full when SENDSPIN_GIT_TAG is one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/pipewire-module-sendspin that referenced this pull request Nov 28, 2026
Sendspin/spec#335 dropped line_sense: every source reports `signal`, and
detecting it from the input level is one way to set it. The module's
keys follow: sendspin.source.signal-detect turns the detection on, and
sendspin.source.signal.threshold-db, .attack-ms and .release-ms tune it.
Without detection the signal is absent, so the server starts the input
only when asked to. The module no longer sets SourceRoleConfig's
line_sense.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/pipewire-module-sendspin that referenced this pull request Nov 28, 2026
sendspin-cpp f49a5bf still sends the client's source@v1_support, which
Sendspin/spec#335 removed and aiosendspin 11.0.0 flags as non-compliant,
and reports the source signal only with line_sense. The submodule and
the FetchContent fallback now use 96e002d from meiser79/sendspin-cpp,
the commit of Sendspin/sendspin-cpp#287, until that is in a release.

A shallow clone cannot check out a commit hash, so the fallback clones
in full when SENDSPIN_GIT_TAG is one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/pipewire-module-sendspin that referenced this pull request Nov 28, 2026
Sendspin/spec#335 dropped line_sense: every source reports `signal`, and
detecting it from the input level is one way to set it. The module's
keys follow: sendspin.source.signal-detect turns the detection on, and
sendspin.source.signal.threshold-db, .attack-ms and .release-ms tune it.
Without detection the signal is absent, so the server starts the input
only when asked to. The module no longer sets SourceRoleConfig's
line_sense.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meiser79 added a commit to meiser79/pipewire-module-sendspin that referenced this pull request Nov 28, 2026
sendspin-cpp f49a5bf still sends the client's source@v1_support, which
Sendspin/spec#335 removed and aiosendspin 11.0.0 flags as non-compliant,
and reports the source signal only with line_sense. The submodule and
the FetchContent fallback now use 96e002d from meiser79/sendspin-cpp,
the commit of Sendspin/sendspin-cpp#287, until that is in a release.

A shallow clone cannot check out a commit hash, so the fallback clones
in full when SENDSPIN_GIT_TAG is one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants