Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions driver_wasapi_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,13 @@ func (c *wasapiContext) writeOnRenderThread() error {
return err
}

frames := c.bufferFrames - paddingFrames
if frames <= 0 {
// Defensive check: WASAPI should never report more padding than the buffer size,
// but if it did, the uint32 subtraction below would wrap around to a huge frame
// count and GetBuffer would fail, so skip the write instead.
if paddingFrames >= c.bufferFrames {
return nil
}
frames := c.bufferFrames - paddingFrames

// Get the destination buffer.
dstBuf, err := c.renderClient.GetBuffer(frames)
Expand Down
Loading