Repository navigation
Clarify activation and shared stream lifecycle requirements - #274
Merged
Merged
Conversation
kahrendt
approved these changes
Sep 16, 2026
kahrendt
left a comment
Contributor
There was a problem hiding this comment.
Very thorough, thank you!
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.
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.
Complete the BCP 14 boilerplate, normalize requirement wording, and move operative text out of non-normative notes. Clarify in CONTRIBUTING that requirements belong outside notes regardless of capitalization. Changes beyond keyword normalization:
server/errorfor init failures and permit encryptedclient/goodbyeafter the initial Noise handshake without changing silent-failure handling.client/stateandclient/commandwithout closing solely for their presence, while still processing client-level fields and active-role objects - the client may not yet have received the role removal.stream/startavailability check on the latest client state it received.stream/clearexplicit and changestream/endoutput stopping and buffer clearing from a recommendation to a MUST.stream/clearto active streams: an explicit role list must be non-empty and contain only roles with active streams. Omittingrolesclears all active player and visualizer streams, and the message cannot be sent when no targeted streams are active - this keeps clear and end targeting consistent without requiring both roles to be streaming.stream/endto active streams: an explicit role list must be non-empty and contain only roles with active streams, and the message cannot be sent when none are active. Align role-removal and unavailability teardown with that restriction._support, when that role version defines a support object.server/unpairsubject to initial and re-handshake sequencing, and prevent the generic permission to omitclient/goodbyefrom overriding cases where it is required.This is the final PR for addressing the issues I found with #100.
Closes #100.