aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-10-24 16:31:28 -0700
committerChris Robinson <[email protected]>2015-10-24 16:31:28 -0700
commita57fe89050a1cf909021f2f94e6d96e44e96aa89 (patch)
tree3615f605ece6b91baa5c5ff701ae047eb81c5441
parent298fdb220d2fe13b2c12d842ad40f39d9cf70e51 (diff)
Lock the source queue for writing when updating the playback offset
-rw-r--r--Alc/ALc.c4
-rw-r--r--OpenAL32/alSource.c16
2 files changed, 10 insertions, 10 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index f5e615e8..2faa84d2 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1608,9 +1608,9 @@ void ALCcontext_ProcessUpdates(ALCcontext *context)
if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
Source->Offset >= 0.0)
{
- ReadLock(&Source->queue_lock);
+ WriteLock(&Source->queue_lock);
ApplyOffset(Source);
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
}
new_state = Source->new_state;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index b8677539..0d454882 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -494,14 +494,14 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
!Context->DeferUpdates)
{
- ReadLock(&Source->queue_lock);
+ WriteLock(&Source->queue_lock);
if(ApplyOffset(Source) == AL_FALSE)
{
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
UnlockContext(Context);
SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE);
}
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
}
UnlockContext(Context);
return AL_TRUE;
@@ -676,14 +676,14 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
!Context->DeferUpdates)
{
- ReadLock(&Source->queue_lock);
+ WriteLock(&Source->queue_lock);
if(ApplyOffset(Source) == AL_FALSE)
{
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
UnlockContext(Context);
SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE);
}
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
}
UnlockContext(Context);
return AL_TRUE;
@@ -2569,7 +2569,7 @@ static ALvoid InitSourceParams(ALsource *Source)
*/
ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
{
- ReadLock(&Source->queue_lock);
+ WriteLock(&Source->queue_lock);
if(state == AL_PLAYING)
{
ALCdevice *device = Context->Device;
@@ -2695,7 +2695,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
}
Source->Offset = -1.0;
}
- ReadUnlock(&Source->queue_lock);
+ WriteUnlock(&Source->queue_lock);
}
/* GetSourceSampleOffset