8000 fix(voice): keep audio alive across channel moves by jovolopez · Pull Request #603 · disgoorg/disgo · GitHub
[go: up one dir, main page]

Skip to content

fix(voice): keep audio alive across channel moves - #603

Open
jovolopez wants to merge 3 commits into
disgoorg:masterfrom
jovolopez:fix/voice-channel-move
Open

jovolopez wants to merge 3 commits into
disgoorg:masterfrom
jovolopez:fix/voice-channel-move

Conversation

@jovolopez
Copy link
Copy Markdown
Contributor

When a bot is moved from one channel to another, it often disconnects, and sometimes it simply remains silent (waiting for the DAVE session to be ready). These problems are solved with these two changes:

Rebuild voice transports when moving between channels and ignore stale callbacks
A channel move was reusing the old Gateway/UDP/DAVE generation and stale SSRC entries carried over from the old channel, so a late Ready/SessionDescription or speaking event could revive the old epoch and drop the new handshake. On moved VoiceStateUpdate the generation is now replaced via resetTransportsLocked() under stateMu and callbacks from previous gateways are dropped. SpeakingFlags are saved in SetSpeaking and restored after SessionDescription.

Wait for the fresh VoiceStateUpdate + VoiceServerUpdate pair instead of closing immediately on 4014/4022
A move can surface as a gateway close. The same thing I make in the PR #583, only without the massive fallback. I'm uploading it here because it's necessary for the complete fix to work; otherwise, the gateway ends up closing in many cases.

Replace stale gateway, UDP, and DAVE transports after a move, ignore
callbacks from old generations, and restore speaking after the new
handshake.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant

0