Repository navigation
Arbitrate every activation and gate audio on playback - #314
Draft
maximmaxim345 wants to merge 8 commits into
Draft
maximmaxim345 wants to merge 8 commits into
maximmaxim345 wants to merge 8 commits into
Conversation
1 task done
6 of 12 tasks
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.
Fixes a gap where a pairing connection held next to a playback connection could add
'playback'without arbitration, so two servers could play on one client.Instead of adding another special case for this, admission is now based on activities, as suggested in #299.
A client still admits one connection by default. One that admits more follows these rules:
'playback', and at most one has'pairing'.activitiesis only admitted alone.Every
server/activateis now arbitrated, not only the first, with the existing ranking and exceptions.'playback'gates the audio: theplayerandvisualizerstreams and the source role'sstart. Artwork, metadata and controller state don't need it, but a server still declares it while the client's group plays, so it can also take over a client that only shows metadata. The client also ignores the audio streams andstarton a connection without'playback', since with unpaired access a pairing connection can still hold these roles. Player commands are ignored the same way, but only while another connection has'playback'.With this, a pairing connection that adds
'playback'displaces the current playback connection, the same way a new connection would.Alternative that keeps the current model and patches each gap with its own rule:
playback#315Closes #299
Breaking change
Clients that admit only one connection keep their admission behavior. Clients that hold a playback and a pairing connection now arbitrate every activation, which changes three outcomes the old text defined:
All three follow from the general rules. The second and third match what a client with one connection already does, and the first mirrors the existing case of a pairing connection arriving during playback. The alternative only changes the second one and keeps the other two as they are today.
Servers must not start a
playerorvisualizerstream or send the sourcestartcommand without'playback', and must end theplayerandvisualizerstreams before dropping it. Clients ignore them without'playback', and a source client stops its input stream when'playback'is dropped. Player commands don't need'playback', so a server can still change the volume of a stopped speaker.Servers should declare
'playback'while the client's group plays or while they use its source, and drop it only once that ends, not at a track change or a move to another playing group: since everyserver/activateis now arbitrated, dropping and re-adding'playback'can hand the client to another server.Limitations and open questions
An idle connection is still only admitted alone, so a client can't hold several servers, for example to show each one's controls and cover. We should be able to drop that limit in a follow-up: since
'playback'now only gates audio, idle connections could coexist, a client that loses'playback'to another server would sendclient/leaveto the old one instead of closing it, and a client that can only show one server sets its own cap. Should we do that?After a successful pairing, the new server is closed when it goes idle while another server plays, and a server that stops while another server pairs is closed too. Which one should keep the client?
A later activation that adds
'pairing'while another server has an attempt in progress closes the connection, so a playback server also loses playback. Keeping it open would need apair/abortreason that doesn't close the connection.I accept the Contributor License Agreement for this contribution.