Skip to content

Commit b9dead9

Browse files
IcebluewolfPaillat-dev
authored andcommitted
fix: Remove Extra Bytes Added By Discord Before OPUS Decoding (Pycord-Development#2925)
* fix: Remove Extra Bytes Added By Discord Before OPUS Decoding * chore: Changelog (cherry picked from commit e5739a2) Signed-off-by: Paillat-dev <[email protected]>
1 parent a13260c commit b9dead9

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ These changes are available on the `master` branch, but have not yet been releas
2020
- Added support for setting guild-specific `avatar`, `banner`, and `bio` for the bot
2121
user through `Member.edit`.
2222
([#2908](https://github.com/Pycord-Development/pycord/pull/2908))
23+
- Added support for select default values.
24+
([#2899](https://github.com/Pycord-Development/pycord/pull/2899))
25+
- Adds a new generic parameter to selects to type `ui.Select.values` return type.
26+
- Adds `SelectDefaultValue` object to create select default values.
27+
- Adds `SelectDefaultValueType` enum.
28+
- Adds pre-typed and pre-constructed with select_type `ui.Select` aliases for the
29+
different select types: `ui.StringSelect`, `ui.UserSelect`, `ui.RoleSelect`,
30+
`ui.MentionableSelect`, and `ui.ChannelSelect`.
2331

2432
### Changed
2533

@@ -29,6 +37,14 @@ These changes are available on the `master` branch, but have not yet been releas
2937
([#2808](https://github.com/Pycord-Development/pycord/pull/2808))
3038
- Unbound `raw` reference in `parse_message_update` causing errors on message updates.
3139
([#2905](https://github.com/Pycord-Development/pycord/pull/2905))
40+
- `view=None` in various methods causing an AttributeError.
41+
([#2915](https://github.com/Pycord-Development/pycord/pull/2915))
42+
- `View.message` being `None` when it had not been interacted with yet.
43+
([#2916](https://github.com/Pycord-Development/pycord/pull/2916))
44+
- Fixed a crash when processing message edit events while message cache was disabled.
45+
([#2924](https://github.com/Pycord-Development/pycord/pull/2924))
46+
- Fixed OPUS Decode Error when recording audio.
47+
([#2925](https://github.com/Pycord-Development/pycord/pull/2925))
3248

3349
### Removed
3450

@@ -106,10 +122,14 @@ These changes are available on the `master` branch, but have not yet been releas
106122
([#2826](https://github.com/Pycord-Development/pycord/pull/2826))
107123
- Added `Interaction.attachment_size_limit`.
108124
([#2854](https://github.com/Pycord-Development/pycord/pull/2854))
125+
- Added support for selects and text displays in modals.
126+
([#2858](https://github.com/Pycord-Development/pycord/pull/2858))
109127
- Added `AuditLogDiff.communication_disabled_until`.
110128
([#2883](https://github.com/Pycord-Development/pycord/pull/2883))
111129
- Added `discord.User.primary_guild` and the `PrimaryGuild` class.
112130
([#2876](https://github.com/Pycord-Development/pycord/pull/2876))
131+
- Added `get_component` to `Message`, `Section`, `Container` and `ActionRow`.
132+
([#2849](https://github.com/Pycord-Development/pycord/pull/2849))
113133

114134
### Fixed
115135

@@ -1136,7 +1156,9 @@ These changes are available on the `master` branch, but have not yet been releas
11361156
- Fix py3.10 UnionType checks issue.
11371157
([#1240](https://github.com/Pycord-Development/pycord/pull/1240))
11381158

1139-
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...HEAD
1159+
[unreleased]: https://github.com/Pycord-Development/pycord/compare/v2.7.0rc1...HEAD
1160+
[2.7.0rc1]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...v2.7.0rc1
1161+
[2.6.1]: https://github.com/Pycord-Development/pycord/compare/v2.6.0...v2.6.1
11401162
[2.6.0]: https://github.com/Pycord-Development/pycord/compare/v2.5.0...v2.6.0
11411163
[2.5.0]: https://github.com/Pycord-Development/pycord/compare/v2.4.1...v2.5.0
11421164
[2.4.1]: https://github.com/Pycord-Development/pycord/compare/v2.4.0...v2.4.1

discord/voice_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,9 @@ def _decrypt_aead_xchacha20_poly1305_rtpsize(self, header, data):
634634
nonce[:4] = data[-4:]
635635
data = data[:-4]
636636

637-
return self.strip_header_ext(box.decrypt(bytes(data), bytes(header), bytes(nonce)))
637+
r =box.decrypt(bytes(data), bytes(header), bytes(nonce))# Discord adds 8 bytes of data before the opus data.
638+
# This can be removed, and at this time, discarded as it is unclear what they are for.
639+
return r[8:]
638640

639641
@staticmethod
640642
def strip_header_ext(data):
@@ -750,7 +752,7 @@ def unpack_audio(self, data):
750752
data: :class:`bytes`
751753
Bytes received by Discord via the UDP connection used for sending and receiving voice data.
752754
"""
753-
if data[1] != 0x78:
755+
if data[1] & 0x78 != 0x78:
754756
# We Should Ignore Any Payload Types We Do Not Understand
755757
# Ref RFC 3550 5.1 payload type
756758
# At Some Point We Noted That We Should Ignore Only Types 200 - 204 inclusive.

0 commit comments

Comments
 (0)