Skip to content

Commit

Permalink
audio: a little more robustness in the capture device's thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Aug 2, 2016
1 parent d662bc0 commit 6bd1ec6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/audio/SDL_audio.c
Expand Up @@ -729,7 +729,6 @@ SDL_CaptureAudio(void *devicep)

while (still_need > 0) {
const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need);
SDL_assert(rc != 0); /* device should have blocked, failed, or returned data. */
SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */
if (rc > 0) {
still_need -= rc;
Expand All @@ -751,7 +750,9 @@ SDL_CaptureAudio(void *devicep)

/* !!! FIXME: this should be LockDevice. */
SDL_LockMutex(device->mixer_lock);
if (!SDL_AtomicGet(&device->paused)) {
if (SDL_AtomicGet(&device->paused)) {
current_audio.impl.FlushCapture(device); /* one snuck in! */
} else {
(*callback)(udata, stream, stream_len);
}
SDL_UnlockMutex(device->mixer_lock);
Expand Down

0 comments on commit 6bd1ec6

Please sign in to comment.