Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
237b2938
Commit
237b2938
authored
Jul 29, 2007
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Jul 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Replace buffer critical section with a rw-lock.
parent
629e013d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
32 deletions
+27
-32
buffer.c
dlls/dsound/buffer.c
+22
-27
dsound_private.h
dlls/dsound/dsound_private.h
+1
-1
mixer.c
dlls/dsound/mixer.c
+2
-2
primary.c
dlls/dsound/primary.c
+2
-2
No files found.
dlls/dsound/buffer.c
View file @
237b2938
...
...
@@ -216,7 +216,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
}
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
if
(
This
->
dsbd
.
dwFlags
&
DSBCAPS_CTRL3D
)
{
oldVol
=
This
->
ds3db_lVolume
;
...
...
@@ -239,7 +239,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetVolume(
}
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -288,7 +288,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(
}
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
oldFreq
=
This
->
freq
;
This
->
freq
=
freq
;
...
...
@@ -298,7 +298,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(
DSOUND_RecalcFormat
(
This
);
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
DS_OK
;
...
...
@@ -312,7 +312,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Play(
TRACE
(
"(%p,%08x,%08x,%08x)
\n
"
,
This
,
reserved1
,
reserved2
,
flags
);
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
This
->
playflags
=
flags
;
if
(
This
->
state
==
STATE_STOPPED
)
{
...
...
@@ -329,7 +329,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Play(
This
->
state
=
STATE_PLAYING
;
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -342,7 +342,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
TRACE
(
"(%p)
\n
"
,
This
);
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
if
(
This
->
state
==
STATE_PLAYING
)
This
->
state
=
STATE_STOPPING
;
...
...
@@ -357,7 +357,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface)
}
DSOUND_CheckEvent
(
This
,
0
,
0
);
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -380,8 +380,7 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
if
(
!
ref
)
{
DirectSoundDevice_RemoveBuffer
(
This
->
device
,
This
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
(
This
->
lock
));
RtlDeleteResource
(
&
This
->
lock
);
if
(
This
->
hwbuf
)
{
IDsDriverBuffer_Release
(
This
->
hwbuf
);
...
...
@@ -568,7 +567,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
}
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceShared
(
&
This
->
lock
,
TRUE
);
if
(
!
(
This
->
device
->
drvdesc
.
dwFlags
&
DSDDESC_DONTNEEDSECONDARYLOCK
)
&&
This
->
hwbuf
)
{
hres
=
IDsDriverBuffer_Lock
(
This
->
hwbuf
,
...
...
@@ -578,7 +577,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
0
);
if
(
hres
!=
DS_OK
)
{
WARN
(
"IDsDriverBuffer_Lock failed
\n
"
);
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
return
hres
;
}
}
else
{
...
...
@@ -603,7 +602,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
}
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
DS_OK
;
...
...
@@ -617,7 +616,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(
TRACE
(
"(%p,%d)
\n
"
,
This
,
newpos
);
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
/* start mixing from this new location instead */
newpos
%=
This
->
buflen
;
...
...
@@ -634,7 +633,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(
WARN
(
"IDsDriverBuffer_SetPosition failed
\n
"
);
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -661,7 +660,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetPan(
}
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceExclusive
(
&
This
->
lock
,
TRUE
);
if
(
This
->
volpan
.
lPan
!=
pan
)
{
This
->
volpan
.
lPan
=
pan
;
...
...
@@ -674,7 +673,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetPan(
}
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -710,7 +709,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(
TRACE
(
"(%p,%p,%d,%p,%d)
\n
"
,
This
,
p1
,
x1
,
p2
,
x2
);
/* **** */
EnterCriticalSection
(
&
(
This
->
lock
)
);
RtlAcquireResourceShared
(
&
This
->
lock
,
TRUE
);
if
(
!
(
This
->
device
->
drvdesc
.
dwFlags
&
DSDDESC_DONTNEEDSECONDARYLOCK
)
&&
This
->
hwbuf
)
{
hres
=
IDsDriverBuffer_Unlock
(
This
->
hwbuf
,
p1
,
x1
,
p2
,
x2
);
...
...
@@ -718,7 +717,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Unlock(
WARN
(
"IDsDriverBuffer_Unlock failed
\n
"
);
}
LeaveCriticalSection
(
&
(
This
->
lock
)
);
RtlReleaseResource
(
&
This
->
lock
);
/* **** */
return
hres
;
...
...
@@ -1099,8 +1098,7 @@ HRESULT IDirectSoundBufferImpl_Create(
}
else
DSOUND_RecalcVolPan
(
&
(
dsb
->
volpan
));
InitializeCriticalSection
(
&
(
dsb
->
lock
));
dsb
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": IDirectSoundBufferImpl.lock"
);
RtlInitializeResource
(
&
dsb
->
lock
);
/* register buffer if not primary */
if
(
!
(
dsbd
->
dwFlags
&
DSBCAPS_PRIMARYBUFFER
))
{
...
...
@@ -1108,8 +1106,7 @@ HRESULT IDirectSoundBufferImpl_Create(
if
(
err
!=
DS_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
->
memory
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
dsb
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
(
dsb
->
lock
));
RtlDeleteResource
(
&
dsb
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
dsb
=
NULL
;
...
...
@@ -1237,14 +1234,12 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
CopyMemory
(
dsb
->
pwfx
,
pdsb
->
pwfx
,
size
);
InitializeCriticalSection
(
&
(
dsb
->
lock
));
dsb
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": IDirectSoundBufferImpl.lock"
);
RtlInitializeResource
(
&
dsb
->
lock
);
/* register buffer */
hres
=
DirectSoundDevice_AddBuffer
(
device
,
dsb
);
if
(
hres
!=
DS_OK
)
{
dsb
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
(
dsb
->
lock
));
RtlDeleteResource
(
&
dsb
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
dsb
);
...
...
dlls/dsound/dsound_private.h
View file @
237b2938
...
...
@@ -157,7 +157,7 @@ struct IDirectSoundBufferImpl
/* IDirectSoundBufferImpl fields */
SecondaryBufferImpl
*
secondary
;
DirectSoundDevice
*
device
;
CRITICAL_SECTION
lock
;
RTL_RWLOCK
lock
;
PIDSDRIVERBUFFER
hwbuf
;
PWAVEFORMATEX
pwfx
;
BufferMemory
*
buffer
;
...
...
dlls/dsound/mixer.c
View file @
237b2938
...
...
@@ -697,7 +697,7 @@ static DWORD DSOUND_MixToPrimary(const DirectSoundDevice *device, DWORD playpos,
if
(
dsb
->
buflen
&&
dsb
->
state
&&
!
dsb
->
hwbuf
)
{
TRACE
(
"Checking %p, mixlen=%d
\n
"
,
dsb
,
mixlen
);
EnterCriticalSection
(
&
(
dsb
->
lock
)
);
RtlAcquireResourceShared
(
&
dsb
->
lock
,
TRUE
);
/* if buffer is stopping it is stopped now */
if
(
dsb
->
state
==
STATE_STOPPING
)
{
...
...
@@ -729,7 +729,7 @@ static DWORD DSOUND_MixToPrimary(const DirectSoundDevice *device, DWORD playpos,
*
all_stopped
=
FALSE
;
}
LeaveCriticalSection
(
&
(
dsb
->
lock
)
);
RtlReleaseResource
(
&
dsb
->
lock
);
}
}
...
...
dlls/dsound/primary.c
View file @
237b2938
...
...
@@ -460,12 +460,12 @@ HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex)
IDirectSoundBufferImpl
**
dsb
=
device
->
buffers
;
for
(
i
=
0
;
i
<
device
->
nrofbuffers
;
i
++
,
dsb
++
)
{
/* **** */
EnterCriticalSection
(
&
((
*
dsb
)
->
lock
)
);
RtlAcquireResourceExclusive
(
&
(
*
dsb
)
->
lock
,
TRUE
);
(
*
dsb
)
->
freqAdjust
=
((
*
dsb
)
->
freq
<<
DSOUND_FREQSHIFT
)
/
wfex
->
nSamplesPerSec
;
LeaveCriticalSection
(
&
((
*
dsb
)
->
lock
)
);
RtlReleaseResource
(
&
(
*
dsb
)
->
lock
);
/* **** */
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment