We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6074196 commit 18d37fbCopy full SHA for 18d37fb
pcm.go
@@ -19,6 +19,7 @@ import (
19
"encoding/binary"
20
"fmt"
21
"io"
22
+ "math"
23
"slices"
24
"sync"
25
"time"
@@ -206,7 +207,7 @@ func (w *sampleWriter[T]) WriteSample(in T) error {
206
207
timeSinceLastWrite := time.Since(w.lastWrite)
208
tolerance := w.sampleDur / 10
209
if timeSinceLastWrite > w.sampleDur+tolerance {
- droppedPackets = uint16((timeSinceLastWrite - w.sampleDur) / w.sampleDur)
210
+ droppedPackets = uint16(math.Round(float64(timeSinceLastWrite-w.sampleDur) / float64(w.sampleDur)))
211
}
212
213
0 commit comments