8000 How to avoid microphone stutter? · mackron miniaudio · Discussion #1147 · GitHub
[go: up one dir, main page]

Skip to content
Discussion options

You must be logged in to vote

The stutter isn't a device or latency setting — you're silently dropping frames on every ring-buffer wrap. There's also an unrelated use-after-free in the stream path that will bite you separately.

1. acquire_write / acquire_read only ever give you a contiguous run

This is the direct cause. From ma_rb_acquire_write:

if (writeOffsetLoopFlag == readOffsetLoopFlag) {
    bytesAvailable = pRB->subbufferSizeInBytes - writeOffsetInBytes;
} else {
    bytesAvailable = readOffsetInBytes - writeOffsetInBytes;
}

bytesRequested = *pSizeInBytes;
if (bytesRequested > bytesAvailable) {
    bytesRequested = bytesAvailable;
}

It clamps to the end of the buffer, never wraps. A single acquire/commit pair …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@GeeTwentyFive
Comment options

@gitsult4n
Comment options

Answer selected by GeeTwentyFive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
0