Skip to content

Commit 15b73b0

Browse files
committed
Check for end-of-stream audio packets
This had an off-by-one check. This should fix #903.
1 parent fc47b01 commit 15b73b0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

TSLib/Audio/AudioPacketReader.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public void Write(Span<byte> data, Meta? meta)
2222
if (OutStream is null || meta is null)
2323
return;
2424

25-
if (data.Length < 5) // Invalid packet
25+
// End of stream is signalled with no data or a single byte.
26+
// The header has 5 bytes, so check for 6.
27+
if (data.Length < 6)
2628
return;
2729

2830
// Skip [0,2) Voice Packet Id for now

0 commit comments

Comments
 (0)