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

fix(Voice*): filter out silent audio from video users #5035

Merged
merged 3 commits into from Nov 25, 2020

Conversation

amishshah
Copy link
Member

Please describe the changes this PR makes and why it should be merged:

Problem:
This resolves #5019. When a user has video enabled, they send silent audio frames continually even if they are not speaking. Discord.js didn't check whether a received audio packet was silence or not for performance reasons. This shortcut is no longer applicable since it causes the incorrect behaviour described in the issue above.

Fix:
Instead of decoding all the received packets, we only decode the packets from users with video enabled (which is where the issue occurs). If a packet is received from such a user and it turns out to be silent audio, the packet is ignored which is a graceful fix for this issue. This means performance will only degrade (and even then, I doubt it will be by a lot) in cases where a bot is in the same voice channel as users with video enabled, and the bot is actively receiving audio.

Status

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

@amishshah amishshah marked this pull request as ready for review November 22, 2020 18:29
@amishshah amishshah requested a review from a team November 22, 2020 18:37
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.

None yet

3 participants