aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-08-18 17:18:53 -0700
committerChris Robinson <[email protected]>2012-08-18 17:18:53 -0700
commita56a9741495e53dcccfe611047d36011010c5657 (patch)
tree5a383ba4fdee14ba557fe58e121aa28dcc5ab7c8 /Alc/backends
parentaf7f3768fa0a9c09bdcf91b65b021c9ee98cb06d (diff)
Hold the device lock with ALSA between mixing and writing
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c4
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;