-
-
Notifications
You must be signed in to change notification settings - Fork 40
Refactor voice receiving #283
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
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
76ba800
Refactor voice receiving
KubaZ2 de0f19a
Add DoNotParallelize attribute to idle timeout tests
KubaZ2 b493ee9
Fix a test
KubaZ2 585eb58
Update BufferedVoiceReceiveHandlerTests to support async operations
KubaZ2 0ccb532
Improve tests and the buffered handler
KubaZ2 9b09128
feat: Enhance voice handling with loss correction capabilities
KubaZ2 78d436e
Correct (I believe) logic for handling lost packets in BufferedVoiceR…
KubaZ2 a6dd028
Refactor
KubaZ2 0c1a91c
Update buffered voice receive handler
KubaZ2 28578ea
Improve voice receive handler
KubaZ2 6633b33
Add FEC support
KubaZ2 2c9f64a
Add FEC handling to BufferedVoiceReceiveHandlerTests
KubaZ2 e32d0cf
Improve EvictLostFrames and rewrite and improve tests
KubaZ2 a0253f3
Refactor VoiceReceiveEventArgs and LostVoiceReceiveEventArgs for clar…
KubaZ2 00b7a5c
Refactor test voice commands
KubaZ2 38207bd
Replace delegate with Action for VoiceReceive event in VoiceReceiveHa…
KubaZ2 6b42f84
Remove commented-out code and unnecessary console output in VoiceClie…
KubaZ2 741287f
Remove unused using directive from BufferedVoiceReceiveHandler
KubaZ2 f89d2e4
Optimize buffered voice receive handler state allocations
KubaZ2 0b767c3
Refactor window and buffer range checks in BufferedVoiceReceiveHandle…
KubaZ2 286ca61
Rename stop timer to timeout timer and improve datagram length valida…
KubaZ2 c2ef169
Refactor BufferedVoiceReceiveHandler to use VoiceReceiveData for impr…
KubaZ2 9912051
Merge alpha
KubaZ2 221ddfd
Remove BufferedVoiceReceiveHandler
KubaZ2 23dbe8c
Cleanup
KubaZ2 66cd723
Simplify voice receive event args
KubaZ2 0250885
Abandon VoiceReceiveHandler
KubaZ2 40af027
Fix voice guide snippet
KubaZ2 94ff6bb
Remove allow unsafe blocks from NetCord.Test.csproj
KubaZ2 5595a5b
Make voice receiving exception safe against malformed payloads (hopef…
KubaZ2 90fce34
Skip decryption when there is no VoiceReceive event handler and remov…
KubaZ2 27e8b1d
Fix voice receive logging and refactor
KubaZ2 02743d1
Add a new line
KubaZ2 c57c2bd
Add a comment to ReceiveVoice in guide snippet
KubaZ2 322d8c2
Make IP Discovery mandatory
KubaZ2 60cf5a5
Optimize logging
KubaZ2 3592f93
Improve a guides snippet comment and refactor VoiceClient slightly
KubaZ2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,35 @@ | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| namespace NetCord.Gateway.Voice; | ||
|
|
||
| public readonly ref struct VoiceReceiveEventArgs(byte[]? buffer, int frameIndex, int frameLength, uint ssrc, uint? timestamp, ushort sequenceNumber) | ||
| [StructLayout(LayoutKind.Auto)] | ||
| public readonly ref struct VoiceReceiveEventArgs | ||
| { | ||
| internal readonly byte[]? _buffer = buffer; | ||
| public VoiceReceiveEventArgs(ReadOnlySpan<byte> frame, uint ssrc, uint timestamp, ushort sequenceNumber) | ||
| { | ||
| Frame = frame; | ||
| Ssrc = ssrc; | ||
| Timestamp = timestamp; | ||
| SequenceNumber = sequenceNumber; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The voice frame data. | ||
| /// </summary> | ||
| public ReadOnlySpan<byte> Frame => new(_buffer, frameIndex, frameLength); | ||
| public readonly ReadOnlySpan<byte> Frame { get; } | ||
|
|
||
| /// <summary> | ||
| /// The synchronization source (SSRC) of the sender of the voice frame. | ||
| /// </summary> | ||
| public uint Ssrc => ssrc; | ||
| public readonly uint Ssrc { get; } | ||
|
|
||
| /// <summary> | ||
| /// The timestamp of the voice frame. <see langword="null"/> when the frame was lost. | ||
| /// The timestamp of the voice frame. | ||
| /// </summary> | ||
| public uint? Timestamp => timestamp; | ||
| public readonly uint Timestamp { get; } | ||
|
|
||
| /// <summary> | ||
| /// The sequence number of the voice frame. | ||
| /// </summary> | ||
| public ushort SequenceNumber => sequenceNumber; | ||
| public readonly ushort SequenceNumber { get; } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.