Repository navigation
Fold stream/request-format into client/state - #195
Merged
Merged
Conversation
kahrendt
reviewed
Sep 2, 2026
kahrendt
approved these changes
Sep 2, 2026
5 tasks done
chrisuthe
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Sep 17, 2026
Part of #386. One commit per item. - [x] **S-3** – The server sends `start` only after the source object has arrived, the client is available and the role is no longer held. - `request_start()` now queues the request and sends it as soon as all three hold; nothing reaches the wire early. - `request_stop()`, a disconnect or the role's deactivation cancels a queued start. `can_start` exposes the same check. - The source role now uses the activation-state hold from #417, plus one new base hook, `Role.on_hold_released()`. - A `client/state` missing the required `source` object is flagged. - The client SDK now includes the `source` object in every `client/state` while the role is active, so a player+source client includes it in its first state. - [x] **S-7** – `SourceCapture` drops PCM and encoded frames captured more than `MAX_CAPTURE_BACKLOG_US` (500 ms) ago, then continues from live capture without resending `client-stream/start`. - The drop only works when callers pass `capture_timestamp_us`. - A frame the encoder was already holding can still span the gap; the encoder is deliberately not reset. - [x] **S-9** – `client-stream/start` accepts any channel count ≥ 1 and any bit depth from 1 to 32. - The stream is announced at 16, 24 or 32 bits, and 8-bit PCM is widened to 16. - Only PCM depths that are not whole bytes are flagged and refused. - Channel counts without a named layout use PyAV's unnamed layout. - [x] **S-10** – The client SDK sends `signal` only when it advertised `line_sense`. - [x] **S C** – The `SourceCapture.feed()` docstring now covers the clock and default of `capture_timestamp_us`. ## Breaking - `SendspinConnection.send_source_signal()` now raises `RuntimeError` unless the client advertised `source@v1_support.features.line_sense`. Before, it sent the signal anyway. ## Compatibility - A client following an older spec revision may never send the `source` object in `client/state`. - A lenient server (`allow_noncompliant_clients=True`) flags it and treats the client as startable once its initial `client/state` has arrived and it is available. This applies to the initial state only. - A strict server rejects it. - The tolerance is marked `DEPRECATED(spec-pr-195)`: the requirement to send a role's state object on activation comes from Sendspin/spec#195. Sendspin/spec#274 only reworded that paragraph. - **For embedders:** a source can now announce a channel count PyAV cannot downmix (9, 11, 13, 15, 17–23, 25+ channels). Converting such a source to a different channel count makes `SourceBridge` / `AsrcSourceBridge` raise `ValueError` when it is created, so Music Assistant's bridge will fail for those sources. Converting at the same channel count works. ## Deferred - S-4, S-5, S-8 and S-12 move to new issues. - S-6 is tracked separately. - S-11 is left to the maintainers.
2 tasks done
1 of 9 tasks
maximmaxim345
added a commit
to Sendspin/aiosendspin
that referenced
this pull request
Oct 1, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Older clients that declare their artwork channels in `client/hello` require `format`, `width` and `height` on every `stream/start` channel, so they rejected the whole artwork `stream/start` once it contained a `source: none` channel. This happened when a disabled channel came before a streamed one, when every channel was disabled, or when a `stream/request-format` disabled a channel, and artwork then never started. It affects `sendspin-cpp` up to 0.8.0, `sendspin-rs` up to 0.3.7 and the `aiosendspin` client up to 9.1.1. These clients now get the format and size they declared on their `none` channels as well. Clients on the `client/state` wire are unchanged. **Related issue or spec PR (if applicable):** - Sendspin/spec#195 ## 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`
1 of 9 tasks
maximmaxim345
added a commit
to Sendspin/sendspin-js
that referenced
this pull request
Nov 26, 2026
# What does this implement/fix? <!-- Quick description and explanation of changes. --> Apps can now tell the server which format they prefer at runtime with `setPreferredFormat()`, for example to switch between FLAC and Opus without reconnecting. It sends the optional `format` field of the `client/state` player object, which replaced `stream/request-format` in the spec. `null` clears the preference. The new `supportedFormats` getter lists the formats the player advertised, since they depend on the browser. `MessageType.STREAM_REQUEST_FORMAT` stays, marked deprecated. The sample player has a dropdown for it. **Related issue or spec PR (if applicable):** - Closes #115 - Sendspin/spec#195 ## 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` - [x] 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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stream/request-formatwas a request in name only: a decline is invisible (the stream continues and the request MUST NOT be treated as an error), so a client only ever learns the operative configuration fromstream/start, and with no stream active the server already had to remember the requested format as de facto state. Per the CONTRIBUTING rule that fields expected to change during a connection belong inclient/state, the message is dropped and its fields move there.Changes
playergains an optionalformatpreference in its state object; absent means the server selects per thesupported_formatspriority order, a present preference must be one of the listed entries (which also removes the previously undefined partial-request case), and the server may still deviate, for example to match a track's native sample rate or to apply an operator-configured format.artworkmoves the per-channelsource/format/width/heightinto a statechannelsarray andartwork@v1_supportis removed entirely: the array is positional from channel 0, an uncovered channel issource: 'none'so clients may truncate after their last active channel, an array longer than 4 is a protocol error, andformat/width/heightare required only whensourceis not'none'.visualizermovestypes,rate_maxandspectruminto state; its hello object keeps onlybuffer_capacity.stream/startnow derives each role's configuration from the hello constants plus the role's current state, answers a state change on an active stream with a newstream/startwhen the configuration changed, never starts a stream in response, and should wait for the state update a role (re-)activation requires before starting that role's stream.Breaking changes
The
stream/request-formatmessage is removed; clients that send it break, and servers drop the handler. Artwork clients no longer sendartwork@v1_supportand instead carry their channel configuration inclient/state; visualizer clients keep onlybuffer_capacityin their support object and carry the rest inclient/state. Players are affected only if they usedstream/request-format; the newformatstate field is optional.Conflicts with #177 in the player state object; whichever lands second needs a rebase.
Closes #190