Fix WriteSilentFramesAsync sending a partial frame at first (#3094)

* Implemented ClientDisconnect event for audio client.

* Added a method for sending silent frames.

* moved comment

* Added method summary.
+ removed changes to project file.

* Removed residual stuff remaining from previous edits.

* bunch of things

* Revert "bunch of things"

This reverts commit 292f23f4e1aabb26d2a3e5b9a2bdff8b5554635e.

* Update src/Discord.Net.WebSocket/Audio/Streams/OpusEncodeStream.cs

* Update src/Discord.Net.WebSocket/Audio/Streams/OpusEncodeStream.cs

* Update src/Discord.Net.WebSocket/Audio/Streams/OpusEncodeStream.cs

* fixed silent frames

---------

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
Frederik P.
2025-04-26 21:41:47 +02:00
committed by GitHub
parent a8523c5ebd
commit 2da25f395a

View File

@@ -41,7 +41,10 @@ namespace Discord.Audio.Streams
// The rest of the array is already zeroes, so no need to fill the rest.
const int frameCount = 5;
// Discard any remaining partial frame.
_partialFramePos = 0;
const int frameCount = 5; // Discord specifically asks for 5 frames.
for (int i = 0; i < frameCount; i += 1)
{
await WriteAsync(frameBytes, 0, frameBytes.Length).ConfigureAwait(false);