Skip to content

Refactor voice receiving#283

Merged
KubaZ2 merged 37 commits into
alphafrom
feature/voice-receive-handlers
May 29, 2026
Merged

Refactor voice receiving#283
KubaZ2 merged 37 commits into
alphafrom
feature/voice-receive-handlers

Conversation

@KubaZ2
Copy link
Copy Markdown
Member

@KubaZ2 KubaZ2 commented Feb 24, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

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
@KubaZ2 KubaZ2 marked this pull request as ready for review May 28, 2026 20:52
@KubaZ2 KubaZ2 marked this pull request as draft May 28, 2026 20:57
@KubaZ2 KubaZ2 marked this pull request as ready for review May 28, 2026 21:56
@KubaZ2 KubaZ2 requested a review from Copilot May 28, 2026 21:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / IVoiceReceiveHandler with VoiceClientConfiguration.ReceiveVoice.
  • Rework UDP datagram parsing/voice-frame extraction and VoiceReceiveEventArgs shape.
  • Add decodeFec support to OpusDecoder and update decode call sites (including OpusDecodeStream and 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.

Comment thread Tests/NetCord.Test/NetCord.Test.csproj Outdated
Comment thread Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs
Comment thread NetCord/Gateway/Voice/VoiceClient.cs
Comment thread NetCord/Gateway/Voice/VoiceClient.cs Outdated
Comment thread NetCord/Gateway/Voice/VoiceClient.cs
Comment thread NetCord/Gateway/Voice/VoiceClient.cs Outdated
Comment thread NetCord/Gateway/Voice/VoiceClientConfiguration.cs Outdated
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Comment thread NetCord/Gateway/Voice/VoiceClient.cs Outdated
Comment thread NetCord/Gateway/Voice/VoiceClient.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Comment thread Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/VoiceClientConfiguration.cs Outdated
Comment thread NetCord/Gateway/Voice/EventArgs/VoiceReceiveEventArgs.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Comment thread Tests/NetCord.Test/ApplicationCommands/VoiceCommands.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/OpusDecoder.cs
Comment thread NetCord/Gateway/Voice/VoiceClientConfiguration.cs
@KubaZ2 KubaZ2 merged commit dd49057 into alpha May 29, 2026
1 check passed
@KubaZ2 KubaZ2 deleted the feature/voice-receive-handlers branch May 29, 2026 19:43
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.

2 participants