diff options
author | Chris Robinson <[email protected]> | 2012-08-18 17:18:53 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-08-18 17:18:53 -0700 |
commit | a56a9741495e53dcccfe611047d36011010c5657 (patch) | |
tree | 5a383ba4fdee14ba557fe58e121aa28dcc5ab7c8 | |
parent | af7f3768fa0a9c09bdcf91b65b021c9ee98cb06d (diff) |
Hold the device lock with ALSA between mixing and writing
-rw-r--r-- | Alc/backends/alsa.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c index 9f75e71d..d780942e 100644 --- a/Alc/backends/alsa.c +++ b/Alc/backends/alsa.c @@ -505,6 +505,7 @@ static ALuint ALSAProc(ALvoid *ptr) avail -= avail%update_size; // it is possible that contiguous areas are smaller, thus we use a loop + ALCdevice_Lock(Device); while(avail > 0) { frames = avail; @@ -529,6 +530,7 @@ static ALuint ALSAProc(ALvoid *ptr) avail -= frames; } + ALCdevice_Unlock(Device); } return 0; @@ -587,6 +589,7 @@ static ALuint ALSANoMMapProc(ALvoid *ptr) continue; } + ALCdevice_Lock(Device); WritePtr = data->buffer; avail = snd_pcm_bytes_to_frames(data->pcmHandle, data->size); aluMixData(Device, WritePtr, avail); @@ -620,6 +623,7 @@ static ALuint ALSANoMMapProc(ALvoid *ptr) break; } } + ALCdevice_Unlock(Device); } return 0; |