Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
03e5c9fa
Commit
03e5c9fa
authored
Jun 12, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
Jun 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winepulse: Move main loop logic into mmdevapi.
parent
c7431990
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
27 deletions
+50
-27
client.c
dlls/mmdevapi/client.c
+41
-0
main.c
dlls/mmdevapi/main.c
+2
-0
mmdevapi_private.h
dlls/mmdevapi/mmdevapi_private.h
+2
-0
mmdevdrv.c
dlls/winepulse.drv/mmdevdrv.c
+5
-27
No files found.
dlls/mmdevapi/client.c
View file @
03e5c9fa
...
...
@@ -38,6 +38,16 @@ extern void sessions_unlock(void) DECLSPEC_HIDDEN;
extern
struct
audio_session_wrapper
*
session_wrapper_create
(
struct
audio_client
*
client
)
DECLSPEC_HIDDEN
;
static
HANDLE
main_loop_thread
;
void
main_loop_stop
(
void
)
{
if
(
main_loop_thread
)
{
WaitForSingleObject
(
main_loop_thread
,
INFINITE
);
CloseHandle
(
main_loop_thread
);
}
}
void
set_stream_volumes
(
struct
audio_client
*
This
)
{
struct
set_volumes_params
params
;
...
...
@@ -114,6 +124,37 @@ static void dump_fmt(const WAVEFORMATEX *fmt)
}
}
static
DWORD
CALLBACK
main_loop_func
(
void
*
event
)
{
struct
main_loop_params
params
;
SetThreadDescription
(
GetCurrentThread
(),
L"audio_client_main"
);
params
.
event
=
event
;
WINE_UNIX_CALL
(
main_loop
,
&
params
);
return
0
;
}
HRESULT
main_loop_start
(
void
)
{
if
(
!
main_loop_thread
)
{
HANDLE
event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
!
(
main_loop_thread
=
CreateThread
(
NULL
,
0
,
main_loop_func
,
event
,
0
,
NULL
)))
{
ERR
(
"Failed to create main loop thread
\n
"
);
CloseHandle
(
event
);
return
E_FAIL
;
}
SetThreadPriority
(
main_loop_thread
,
THREAD_PRIORITY_TIME_CRITICAL
);
WaitForSingleObject
(
event
,
INFINITE
);
CloseHandle
(
event
);
}
return
S_OK
;
}
static
DWORD
CALLBACK
timer_loop_func
(
void
*
user
)
{
struct
timer_loop_params
params
;
...
...
dlls/mmdevapi/main.c
View file @
03e5c9fa
...
...
@@ -202,6 +202,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
WARN
(
"Unable to deinitialize library: %lx
\n
"
,
status
);
}
main_loop_stop
();
if
(
!
lpvReserved
)
MMDevEnum_Free
();
break
;
...
...
dlls/mmdevapi/mmdevapi_private.h
View file @
03e5c9fa
...
...
@@ -80,4 +80,6 @@ extern HRESULT SpatialAudioClient_Create(IMMDevice *device, ISpatialAudioClient
extern
HRESULT
load_devices_from_reg
(
void
)
DECLSPEC_HIDDEN
;
extern
HRESULT
load_driver_devices
(
EDataFlow
flow
)
DECLSPEC_HIDDEN
;
extern
void
main_loop_stop
(
void
)
DECLSPEC_HIDDEN
;
extern
const
WCHAR
drv_keyW
[]
DECLSPEC_HIDDEN
;
dlls/winepulse.drv/mmdevdrv.c
View file @
03e5c9fa
...
...
@@ -56,7 +56,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(pulse);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
static
HANDLE
pulse_thread
;
static
struct
list
g_sessions
=
LIST_INIT
(
g_sessions
);
static
struct
list
g_devices_cache
=
LIST_INIT
(
g_devices_cache
);
...
...
@@ -115,11 +114,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
LIST_FOR_EACH_ENTRY_SAFE
(
device
,
device_next
,
&
g_devices_cache
,
struct
device_cache
,
entry
)
free
(
device
);
if
(
pulse_thread
)
{
WaitForSingleObject
(
pulse_thread
,
INFINITE
);
CloseHandle
(
pulse_thread
);
}
}
return
TRUE
;
}
...
...
@@ -134,6 +128,8 @@ extern const IAudioClockVtbl AudioClock_Vtbl;
extern
const
IAudioClock2Vtbl
AudioClock2_Vtbl
;
extern
const
IAudioStreamVolumeVtbl
AudioStreamVolume_Vtbl
;
extern
HRESULT
main_loop_start
(
void
)
DECLSPEC_HIDDEN
;
extern
struct
audio_session_wrapper
*
session_wrapper_create
(
struct
audio_client
*
client
)
DECLSPEC_HIDDEN
;
...
...
@@ -157,15 +153,6 @@ static void pulse_release_stream(stream_handle stream, HANDLE timer)
pulse_call
(
release_stream
,
&
params
);
}
static
DWORD
CALLBACK
pulse_mainloop_thread
(
void
*
event
)
{
struct
main_loop_params
params
;
params
.
event
=
event
;
SetThreadDescription
(
GetCurrentThread
(),
L"winepulse_mainloop"
);
pulse_call
(
main_loop
,
&
params
);
return
0
;
}
typedef
struct
tagLANGANDCODEPAGE
{
WORD
wLanguage
;
...
...
@@ -735,19 +722,10 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
return
AUDCLNT_E_ALREADY_INITIALIZED
;
}
if
(
!
pulse_thread
)
if
(
FAILED
(
hr
=
main_loop_start
())
)
{
HANDLE
event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
!
(
pulse_thread
=
CreateThread
(
NULL
,
0
,
pulse_mainloop_thread
,
event
,
0
,
NULL
)))
{
ERR
(
"Failed to create mainloop thread.
\n
"
);
sessions_unlock
();
CloseHandle
(
event
);
return
E_FAIL
;
}
SetThreadPriority
(
pulse_thread
,
THREAD_PRIORITY_TIME_CRITICAL
);
WaitForSingleObject
(
event
,
INFINITE
);
CloseHandle
(
event
);
sessions_unlock
();
return
hr
;
}
params
.
name
=
name
=
get_application_name
(
TRUE
);
...
...
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