Repository navigation
refactor(voice): Strict type checking in voice internals & DAVE Support (rec) - #3159
Paillat-dev wants to merge 55 commits into
Conversation
Discord enforces DAVE (E2E encryption) on all voice channels. py-cord currently decodes Opus packets before stripping the DAVE application-layer encryption, causing OpusError: corrupted stream and making voice reception completely non-functional. Changes: - reader.py: Rewrite decrypt_rtp() to call dave.decrypt() BEFORE Opus decoding. Handles SSRC-to-user_id race condition by trying all known DAVE user IDs when the mapping is not yet populated, then caching the result. Falls back to OPUS_SILENCE on decrypt failure. - opus.py: Remove erroneous dave.decrypt() call in _decode_packet() that was applied to already-decoded PCM data, corrupting the audio stream. - router.py: Catch OpusError and AssertionError in _do_run() gracefully, emitting a single warning instead of crashing the router thread. Fixes: #3139
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3159/head:pr-3159
git checkout pr-3159This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3159/head |
3890460 to
fee38b7
Compare
Co-authored-by: Michael <vmphase.dev@gmail.com> Signed-off-by: Paillat <me@paillat.dev>
|
This seems to have been tested for long enough, and worked for most people. I pushed a last small fix for callbacks mentioned by @vmphase. I think it can be merged, and when released, users will eventually report additional issues if they happen. |
plun1331
left a comment
There was a problem hiding this comment.
i had to unlock this to review it
Co-authored-by: Michael <vmphase.dev@gmail.com> Signed-off-by: Paillat <me@paillat.dev>
Co-authored-by: Michael <vmphase.dev@gmail.com> Signed-off-by: Paillat <me@paillat.dev>
|
Considering this PR being tested by a few people and all of my reviews being addressed — I believe this can be merged now. This PR has already grown too big to recognize small nitpicks, whilst users facing problems can always open a new issue. |
|
If nobody has any more reviews I am going to merge this in a couple days |

Summary
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.