Refactor voice receiving#283
Merged
Merged
Conversation
|
The documentation preview is available at https://preview.netcord.dev/283. |
- Updated VoiceReceiveEventArgs to include a canCorrectLoss flag for better loss management. - Modified OpusDecoder methods to accept a decodeFec parameter for handling forward error correction. - Adjusted OpusDecodeStream to utilize the new OpusDecoder methods. - Enhanced VoiceClient to invoke events with loss correction information. - Refactored VoiceReceiveData to use flags for packet status, including canCorrectLoss. - Updated BufferedVoiceReceiveHandlerTests to validate new loss correction behavior. - Added tests for canCorrectLoss scenarios to ensure proper handling of lost packets. - Adjusted VoiceCommands to utilize updated decoding logic for handling voice frames.
…ity and improved FEC handling; update VoiceCommands to streamline lost frame handling
…nt and BufferedVoiceReceiveHandler
…r for clarity and correctness
…tion in VoiceClient
…oved clarity and data handling
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the voice receive pipeline by removing the configurable receive-handler abstraction and introducing a simpler ReceiveVoice configuration switch, while updating samples/docs and extending Opus decoding APIs to support FEC selection.
Changes:
- Replace
ReceiveHandler/IVoiceReceiveHandlerwithVoiceClientConfiguration.ReceiveVoice. - Rework UDP datagram parsing/voice-frame extraction and
VoiceReceiveEventArgsshape. - Add
decodeFecsupport toOpusDecoderand update decode call sites (includingOpusDecodeStreamand sample commands/docs).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/NetCord.Test/NetCord.Test.csproj | Enables unsafe blocks for the test project. |
| Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs | Updates join/echo/record sample commands to the new receive model and Opus decoder API. |
| NetCord/Gateway/Voice/VoiceReceiveHandler.cs | Removes the old receive handler implementation. |
| NetCord/Gateway/Voice/VoiceClientConfiguration.cs | Replaces ReceiveHandler with ReceiveVoice. |
| NetCord/Gateway/Voice/VoiceClient.cs | Refactors UDP receive handling and voice packet processing. |
| NetCord/Gateway/Voice/Streams/OpusDecodeStream.cs | Updates decoder calls to include the new FEC parameter. |
| NetCord/Gateway/Voice/OpusDecoder.cs | Adds decodeFec parameter to decode APIs and updates docs. |
| NetCord/Gateway/Voice/NullVoiceReceiveHandler.cs | Removes the old null receive handler. |
| NetCord/Gateway/Voice/IVoiceReceiveHandler.cs | Removes the old handler interface. |
| NetCord/Gateway/Voice/EventArgs/VoiceReceiveEventArgs.cs | Changes event args to carry a ReadOnlySpan<byte> frame and non-null timestamp. |
| Documentation/guides/basic-concepts/Voice/VoiceModule.cs | Updates guide sample to ReceiveVoice = true and new timestamp semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.