This commit is contained in:
2026-09-02 01:00:09 +03:00
parent 166744fe88
commit eaa46e7494
17 changed files with 1351 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
package mic
// ponytail: cap listen buffer at 5s; excess dropped from front (slow poll won't OOM agent).
const maxChunkPCM = SampleRate * BytesPerSample * 5
func appendChunkPCM(buf []byte, pcm []byte) []byte {
if len(pcm) == 0 {
return buf
}
buf = append(buf, pcm...)
if len(buf) <= maxChunkPCM {
return buf
}
return append([]byte(nil), buf[len(buf)-maxChunkPCM:]...)
}