aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-28 23:18:51 -0800
committerChris Robinson <[email protected]>2017-02-28 23:18:51 -0800
commitd1833c7b94fef1b6af73c1f33dd2441d80d95852 (patch)
tree84b9e3360942d896bf1e0817d67f98fd66a5731d /Alc/ALc.c
parent521abf2e0725cc4e4abfc17e75681e47fb372f68 (diff)
Increment MixCount in UpdateClockBase
This is to protect clocktime reads since the backend lock won't protect it.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index b46244aa..59475e48 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1780,12 +1780,15 @@ static void alcSetError(ALCdevice *device, ALCenum errorCode)
*
* Updates the device's base clock time with however many samples have been
* done. This is used so frequency changes on the device don't cause the time
- * to jump forward or back.
+ * to jump forward or back. Must not be called while the device is running/
+ * mixing.
*/
static inline void UpdateClockBase(ALCdevice *device)
{
+ IncrementRef(&device->MixCount);
device->ClockBase += device->SamplesDone * DEVICE_CLOCK_RES / device->Frequency;
device->SamplesDone = 0;
+ IncrementRef(&device->MixCount);
}
/* UpdateDeviceParams