Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice overhaul #1593

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Voice overhaul #1593

wants to merge 3 commits into from

Conversation

ozraru
Copy link
Contributor

@ozraru ozraru commented Jan 18, 2025

I've rewrited entire code related to Voice.

This is very big pull request.
I'm sorry, I understand that it is difficult to review.
But I believe that this is valuable to check.

I'm not good at English. Wording fixes are welcome.
I'm not sure about the naming. Naming changes are also welcome.

I want to support E2EE in the future but it's not included in this pull request.


Summary

  • Use context to manage goroutines and connections

  • Eliminate busy wait using sync.Cond

  • Use Voice Gateway Version 8

  • Change to new transport encryption mode

    • aead_aes256_gcm_rtpsize and aead_xchacha20_poly1305_rtpsize
  • Resume Voice Conenction

  • Delete reconnection (excludes resume)

    • It is very rare and it should be handled by an application
  • Deliver unrecoverable error to the application

  • Edit some examples to work with these changes

Breaking changes

  • misc
    • Some functions require context.Context in argument
      • It can be used to set timeout
  • Session
    • Renamed ChannelVoiceJoinManual to VoiceStateUpdate
    • Remove ShouldReconnectVoiceOnSessionError
      • Because reconnection are deleted
  • VoiceConenction
    • Removed Ready
      • Use Status instead
    • Removed Debug
      • already deprecated
    • Removed ChangeChannel
      • Use Session.VoiceStateUpdate
    • Removed Close
      • Kill is alternative, but why not use Disconnect?
  • Packet
    • Removed Type
      • Separated to Flags and PayloadType

note: Currently using transport encryption mode(xsalsa20_poly1305) and voice gateway version(connecting without a version) is already discontinued according to the document. (but it works currently 🤔 )

Versions below 4 as well as the default version behaviour will be discontinued as of November 18th, 2024. Connections without a version or with a version less than version 4 will be rejected as of this date.
https://discord.com/developers/docs/topics/voice-connections#voice-gateway-versioning

The deprecated encryption modes above will be discontinued as of November 18th, 2024. As of this date the voice gateway will not allow you to connect with one of the deprecated encryption modes.
https://discord.com/developers/docs/topics/voice-connections#transport-encryption-and-sending-voice

## Summary
- Use context to manage goroutines and connections
- Eliminate busy wait using sync.Cond
- Use Voice Gateway Version 8
- Change to new encryption mode
- Resume Voice Conenction
- Delete reconnect (excludes resume)
  - It is very rare and it should be handled by an application
- Deliver unrecoverable error to the application

- Edit some examples to work with these changes

## Breaking changes
- misc
  - Some functions require context.Context in argument
- Session
  - Renamed ChannelVoiceJoinManual to VoiceStateUpdate
  - Remove ShouldReconnectVoiceOnSessionError
    - Because reconnecting feature are deleted
- VoiceConenction
  - Removed Ready
    - Use Status instead
  - Removed Debug
    - already deprecated
  - Removed ChangeChannel
    - Use Session.VoiceStateUpdate
  - Removed Close
    - Kill is alternative, but why not use Disconnect?
- Packet
  - Removed Type
    - Separated to Flags and PayloadType
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.

1 participant