Skip to content

Conversation

@ToddyTheNoobDud
Copy link
Collaborator

Changes

Added an _ownedSSRCs Set into the connection class, which tracks and deletes the SSRc entries from the global ssrcs object to prevent memory leaks.

replaced Buffer.alloc with Buffer.allocUnsafe for hot paths where the data is immediately overwritten

made 'sendAudioChunk' re-use the packetBuffer for rtp headers, preventing more allocations.

Added support for some dave op codes (21, 22, 24, 25, 27, 28, 30, 31)

Fixed an issue where if you add 2 songs into a queue and skipped, the jitter buffer (Preferred) would go up to 520ms, making the audio stutter for 20 seconds, this commit fixes this issue

Why

As listed in the changes, this PR improves the general code performance, fixes a buffer desync issue, and prevents a memory leak.

Checkmarks

  • [ X ] The modified functions have been tested.
  • [ X ] Used the same indentation as the rest of the project.
  • Updated documentation (changelog).
  • [ X ] Is a documented feature by Discord.

Additional information

Op codes from: https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice

Formatted with biome.

(again, i request an review from pedroo, i fr need to learn more stuff about this area :))

Added an _ownedSSRCs Set into the connection class, which tracks and deletes the SSRc entries from the global ssrcs object to prevent memory leaks.

replaced Buffer.alloc with Buffer.allocUnsafe for hot paths where the data is immediately overwritten

made 'sendAudioChunk' re-use the packetBuffer for rtp headers, preventing more allocations.

Added support for some dave op codes (21, 22, 24, 25, 27, 28, 30, 31)

Fixed an issue where if you add 2 songs into a queue and skipped, the jitter buffer (Preferred) would go up to 520ms, making the audio stutter for 20 seconds, this commit fixes this issue

Signed-off-by: toddynnn <86982643+ToddyTheNoobDud@users.noreply.github.com>
i forgot to re-add the ping case

Signed-off-by: toddynnn <86982643+ToddyTheNoobDud@users.noreply.github.com>
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.

1 participant