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
a6da8f21
Commit
a6da8f21
authored
Dec 21, 2006
by
Ken Thomases
Committed by
Alexandre Julliard
Dec 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecoreaudio: Create port for sending messages to the callback thread only once.
parent
23bb112b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
23 deletions
+37
-23
audio.c
dlls/winmm/winecoreaudio/audio.c
+37
-23
No files found.
dlls/winmm/winecoreaudio/audio.c
View file @
a6da8f21
...
...
@@ -177,7 +177,7 @@ typedef struct {
static
WINE_WAVEOUT
WOutDev
[
MAX_WAVEOUTDRV
];
static
CF
StringRef
MessageThreadPortName
;
static
CF
MessagePortRef
Port_SendToMessageThread
;
static
LPWAVEHDR
wodHelper_PlayPtrNext
(
WINE_WAVEOUT
*
wwo
);
static
DWORD
wodHelper_NotifyCompletions
(
WINE_WAVEOUT
*
wwo
,
BOOL
force
);
...
...
@@ -255,7 +255,7 @@ static const char * getMessage(UINT msg)
#define kWaveInCallbackMessage 2
/* Mach Message Handling */
static
CFDataRef
wodMessageHandler
(
CFMessagePortRef
local
,
SInt32
msgid
,
CFDataRef
data
,
void
*
info
)
static
CFDataRef
wodMessageHandler
(
CFMessagePortRef
port_ReceiveInMessageThread
,
SInt32
msgid
,
CFDataRef
data
,
void
*
info
)
{
UInt32
*
buffer
=
NULL
;
WINE_WAVEOUT
*
wwo
=
NULL
;
...
...
@@ -283,23 +283,17 @@ static CFDataRef wodMessageHandler(CFMessagePortRef local, SInt32 msgid, CFDataR
static
DWORD
WINAPI
messageThread
(
LPVOID
p
)
{
CFMessagePortRef
local
;
CFMessagePortRef
port_ReceiveInMessageThread
=
(
CFMessagePortRef
)
p
;
CFRunLoopSourceRef
source
;
Boolean
info
;
local
=
CFMessagePortCreateLocal
(
kCFAllocatorDefault
,
MessageThreadPortName
,
&
wodMessageHandler
,
NULL
,
&
info
);
source
=
CFMessagePortCreateRunLoopSource
(
kCFAllocatorDefault
,
local
,
(
CFIndex
)
0
);
source
=
CFMessagePortCreateRunLoopSource
(
kCFAllocatorDefault
,
port_ReceiveInMessageThread
,
(
CFIndex
)
0
);
CFRunLoopAddSource
(
CFRunLoopGetCurrent
(),
source
,
kCFRunLoopDefaultMode
);
CFRunLoopRun
();
CFRunLoopSourceInvalidate
(
source
);
CFRelease
(
source
);
CFRelease
(
local
);
CFRelease
(
MessageThreadPortName
);
MessageThreadPortName
=
NULL
;
CFRelease
(
port_ReceiveInMessageThread
);
return
0
;
}
...
...
@@ -310,9 +304,6 @@ static DWORD wodSendDriverCallbackMessage(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dw
UInt32
buffer
[
4
];
SInt32
ret
;
CFMessagePortRef
messagePort
;
messagePort
=
CFMessagePortCreateRemote
(
kCFAllocatorDefault
,
MessageThreadPortName
);
buffer
[
0
]
=
(
UInt32
)
wwo
->
woID
;
buffer
[
1
]
=
(
UInt32
)
wMsg
;
buffer
[
2
]
=
(
UInt32
)
dwParam1
;
...
...
@@ -322,9 +313,8 @@ static DWORD wodSendDriverCallbackMessage(WINE_WAVEOUT* wwo, WORD wMsg, DWORD dw
if
(
!
data
)
return
0
;
ret
=
CFMessagePortSendRequest
(
messagePort
,
kWaveOutCallbackMessage
,
data
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
ret
=
CFMessagePortSendRequest
(
Port_SendToMessageThread
,
kWaveOutCallbackMessage
,
data
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
CFRelease
(
data
);
CFRelease
(
messagePort
);
return
(
ret
==
kCFMessagePortSuccess
)
?
1
:
0
;
}
...
...
@@ -455,6 +445,8 @@ LONG CoreAudio_WaveInit(void)
pthread_mutexattr_t
mutexattr
;
int
i
;
HANDLE
hThread
;
CFStringRef
messageThreadPortName
;
CFMessagePortRef
port_ReceiveInMessageThread
;
TRACE
(
"()
\n
"
);
...
...
@@ -528,35 +520,57 @@ LONG CoreAudio_WaveInit(void)
/* create mach messages handler */
srandomdev
();
M
essageThreadPortName
=
CFStringCreateWithFormat
(
kCFAllocatorDefault
,
NULL
,
m
essageThreadPortName
=
CFStringCreateWithFormat
(
kCFAllocatorDefault
,
NULL
,
CFSTR
(
"WaveMessagePort.%d.%lu"
),
getpid
(),
(
unsigned
long
)
random
());
if
(
!
M
essageThreadPortName
)
if
(
!
m
essageThreadPortName
)
{
ERR
(
"Can't create message thread port name
\n
"
);
return
1
;
}
hThread
=
CreateThread
(
NULL
,
0
,
messageThread
,
NULL
,
0
,
NULL
);
port_ReceiveInMessageThread
=
CFMessagePortCreateLocal
(
kCFAllocatorDefault
,
messageThreadPortName
,
&
wodMessageHandler
,
NULL
,
NULL
);
if
(
!
port_ReceiveInMessageThread
)
{
ERR
(
"Can't create message thread local port
\n
"
);
CFRelease
(
messageThreadPortName
);
return
1
;
}
Port_SendToMessageThread
=
CFMessagePortCreateRemote
(
kCFAllocatorDefault
,
messageThreadPortName
);
CFRelease
(
messageThreadPortName
);
if
(
!
Port_SendToMessageThread
)
{
ERR
(
"Can't create port for sending to message thread
\n
"
);
CFRelease
(
port_ReceiveInMessageThread
);
return
1
;
}
hThread
=
CreateThread
(
NULL
,
0
,
messageThread
,
(
LPVOID
)
port_ReceiveInMessageThread
,
0
,
NULL
);
if
(
!
hThread
)
{
ERR
(
"Can't create message thread
\n
"
);
CFRelease
(
port_ReceiveInMessageThread
);
CFRelease
(
Port_SendToMessageThread
);
Port_SendToMessageThread
=
NULL
;
return
1
;
}
/* The message thread is responsible for releasing port_ReceiveInMessageThread. */
return
0
;
}
void
CoreAudio_WaveRelease
(
void
)
{
/* Stop CFRunLoop in messageThread */
CFMessagePortRef
messagePort
;
int
i
;
TRACE
(
"()
\n
"
);
messagePort
=
CFMessagePortCreateRemote
(
kCFAllocatorDefault
,
MessageThreadPortName
);
CF
MessagePortSendRequest
(
messagePort
,
kStopLoopMessage
,
NULL
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
CFRelease
(
messagePort
)
;
CFMessagePortSendRequest
(
Port_SendToMessageThread
,
kStopLoopMessage
,
NULL
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
CF
Release
(
Port_SendToMessageThread
);
Port_SendToMessageThread
=
NULL
;
for
(
i
=
0
;
i
<
MAX_WAVEOUTDRV
;
++
i
)
{
...
...
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