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

Remove extension from received audio packets #2721

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

davidffa
Copy link
Contributor

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

With the new update (v5.1.0) that uses the new voice encryption modes, when the bot receives audio from regular users (not bots) it throws opus decoder errors in the debug logs.
The issue is that the header extension (present in user's audio packets) is not being stripped from the encoded (but decrypted) audio packet.
This PR fixes that by offseting the decrypted audio ByteBuffer by 4 * extension length in the RTP header .

@MinnDevelopment
Copy link
Member

Please also adjust the test with these changes

@davidffa
Copy link
Contributor Author

The CryptoAdapterTest uses the AudioPacket#asEncryptedPacket method that always writes the RTP header flags as 0x80 (without the header extension bit) and never writes the header extension length, so all the tests still pass.

@MinnDevelopment MinnDevelopment merged commit 18c9508 into discord-jda:master Aug 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants