-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
V12 Master Receiver not Decoding Opus #3550
Comments
I'm getting the same bug on Stable |
I'm getting a similar issue, I have just updated to the latest build. I'm not sure if it was happening before that (a build several months old), but I suspect it was, so maybe a change on the discord end. |
This seems to be happening with my bot as well (on stable). I've tried streaming the audio back to discord and playing it in a voice channel but the sound just comes out like someone is pouring water. lol :-) . I don't get any errors but I'm guessing the packets could be corrupted as E0HH said? |
Please note that Discord does not support receiving audio, so while we can do our best to support it within the library, it is likely to break. In this case, Discord must have made some breaking changes. |
Thanks @amishshah, that explains a lot in my (unsuccessful) search through their docs for the current API version and what may have changed! :/ This is the Discord feature request: discord/discord-api-docs#365 - I'm assuming (hoping) the more +1 they get the more likely they are to do something about it, so if everyone can please click on it that would be great. |
Yeah I can unfortunately confirm this it seems like. After fixing the fact that speaking updates no longer came through properly, I encountered this next. I can still decode the packages to PCM occasionally, but it all comes out as corrupted noise when played back |
I figured it out! For the latest master: In "src/client/voice/receiver/PacketHandler.js" at L66 Replace: With: Explanation: I assume the assumption was that this was just padding, since every packet used to have one zero byte there. However as it turns out that is no longer the case! This byte in question is now 0x02 for most regular packages and 0 for empty/silent packages as far as I can tell. So instead of padding it is probably some additional information byte for the discord client, which previously wasn't used and was merely a placeholder, but now is used. Just reading over it seems to work out fine for now. With the old code it would read over the byte correctly if it was 0, but not if it was 2, which is now the case for most voice packages. This made Opus incorrectly interpret the 0x02 as the TOC byte, which doesn't really make sense. Reading up on the Opus TOC byte made me realize this error. |
@dragonbane0 how and why are you so smart!? This makes two annoying problems you've solved for me now. Thanks :-). Anyway, for anyone wanting to fix this problem on |
Fantastic work @dragonbane0 you sir are a legend. Would of never caught that. Hydra, should someone create a pull request for the change? Code is now working for me on master with the fix above. |
Great find @dragonbane0! Do you want to make a PR for it? :) |
@amishshah sure! Will get on it in a bit |
Help me pls:v
|
I got the same error, that's weird what happens these days 😔 |
@MTGPROD @Ettokun I have just tested with the latest build using my example here: https://github.com/sillyfrog/discord.js-listenexample and things are working as expected. So maybe there is some other library conflict causing issues? I would suggest starting with that example (in Docker) and seeing if you can reproduce from there. |
Please describe the problem you are having in as much detail as possible:
It looks like a change happened with voice packets and it seems they cannot be decoded. Voice packets are still being sent, but when attempting to convert them, or even change the receiver to PCM instead of Opus, they become corrupt. I cannot decode the frames with Opusdec either. Below is code I used for v12 to make a quick idea of whats happening.
Include a reproducible code sample here, if possible:
Further details:
The text was updated successfully, but these errors were encountered: