diff options
author | Chris Robinson <[email protected]> | 2009-05-26 14:54:59 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-05-26 14:54:59 -0700 |
commit | 5a8ad6766034548fac39ba7426891e128ab96591 (patch) | |
tree | 9fbc18d394de88f5b195eeebe0dc218aa1bea8c1 | |
parent | f1e442408bb607e3ca337fc18cf1e52bf38680f0 (diff) |
Lock the context before getting the mmap region to update
-rw-r--r-- | Alc/alsa.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -206,28 +206,30 @@ static ALuint ALSAProc(ALvoid *ptr) { frames = avail; + SuspendContext(NULL); err = psnd_pcm_mmap_begin(data->pcmHandle, &areas, &offset, &frames); if (err < 0) { err = xrun_recovery(data->pcmHandle, err); if (err < 0) AL_PRINT("mmap begin error: %s\n", psnd_strerror(err)); + ProcessContext(NULL); break; } WritePtr = (char*)areas->addr + (offset * areas->step / 8); WriteCnt = psnd_pcm_frames_to_bytes(data->pcmHandle, frames); - SuspendContext(NULL); aluMixData(pDevice->Context, WritePtr, WriteCnt, pDevice->Format); - ProcessContext(NULL); commitres = psnd_pcm_mmap_commit(data->pcmHandle, offset, frames); if (commitres < 0 || (commitres-frames) != 0) { AL_PRINT("mmap commit error: %s\n", psnd_strerror(commitres >= 0 ? -EPIPE : commitres)); + ProcessContext(NULL); break; } + ProcessContext(NULL); avail -= frames; } |