feat: unified audio buffer + fragment reassembly fix

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-16 14:19:02 +01:00
parent fb17813dcb
commit 8ef80530f6
6 changed files with 392 additions and 250 deletions

View File

@@ -36,11 +36,10 @@ type Client struct {
Connected bool
ServerName string
// Fragment reassembly
FragmentBuffer []byte
FragmentStartPktID uint16
FragmentCompressed bool
Fragmenting bool
// Fragment reassembly (packet queue like ts3j)
CommandQueue map[uint16]*protocol.Packet // Packets waiting for reassembly
ExpectedCommandPID uint16 // Next expected packet ID
FragmentState bool // Toggle: true = collecting, false = ready
// Server Data
Channels map[uint64]*Channel
@@ -64,6 +63,8 @@ func NewClient(nickname string) *Client {
VoicePacketID: 1,
Channels: make(map[uint64]*Channel),
VoiceDecoders: make(map[uint16]*opus.Decoder),
CommandQueue: make(map[uint16]*protocol.Packet),
ExpectedCommandPID: 0,
done: make(chan struct{}),
}
}