Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
b1935d83
Commit
b1935d83
authored
Nov 04, 2015
by
Sebastian Lackner
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winepulse.drv: Use a separate mainloop and ctx for pulse_test_connect.
parent
36d69d19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
32 deletions
+30
-32
pulse.c
dlls/winepulse.drv/pulse.c
+30
-32
No files found.
dlls/winepulse.drv/pulse.c
View file @
b1935d83
...
...
@@ -661,7 +661,8 @@ static void convert_channel_map(const pa_channel_map *pa_map, WAVEFORMATEXTENSIB
fmt
->
dwChannelMask
=
pa_mask
;
}
static
void
pulse_probe_settings
(
int
render
,
const
char
*
pulse_name
,
WAVEFORMATEXTENSIBLE
*
fmt
,
REFERENCE_TIME
*
def_period
,
REFERENCE_TIME
*
min_period
)
static
void
pulse_probe_settings
(
pa_mainloop
*
ml
,
pa_context
*
ctx
,
int
render
,
const
char
*
pulse_name
,
WAVEFORMATEXTENSIBLE
*
fmt
,
REFERENCE_TIME
*
def_period
,
REFERENCE_TIME
*
min_period
)
{
WAVEFORMATEX
*
wfx
=
&
fmt
->
Format
;
pa_stream
*
stream
;
...
...
@@ -684,7 +685,7 @@ static void pulse_probe_settings(int render, const char *pulse_name, WAVEFORMATE
attr
.
minreq
=
attr
.
fragsize
=
pa_frame_size
(
&
ss
);
attr
.
prebuf
=
0
;
stream
=
pa_stream_new
(
pulse_
ctx
,
"format test stream"
,
&
ss
,
&
map
);
stream
=
pa_stream_new
(
ctx
,
"format test stream"
,
&
ss
,
&
map
);
if
(
stream
)
pa_stream_set_state_callback
(
stream
,
pulse_stream_state
,
NULL
);
if
(
!
stream
)
...
...
@@ -695,7 +696,7 @@ static void pulse_probe_settings(int render, const char *pulse_name, WAVEFORMATE
else
ret
=
pa_stream_connect_record
(
stream
,
pulse_name
,
&
attr
,
PA_STREAM_START_CORKED
|
PA_STREAM_FIX_RATE
|
PA_STREAM_FIX_CHANNELS
|
PA_STREAM_EARLY_REQUESTS
);
if
(
ret
>=
0
)
{
while
(
pa_mainloop_iterate
(
pulse_
ml
,
1
,
&
ret
)
>=
0
&&
while
(
pa_mainloop_iterate
(
ml
,
1
,
&
ret
)
>=
0
&&
pa_stream_get_state
(
stream
)
==
PA_STREAM_CREATING
)
{}
if
(
pa_stream_get_state
(
stream
)
==
PA_STREAM_READY
)
{
...
...
@@ -706,7 +707,7 @@ static void pulse_probe_settings(int render, const char *pulse_name, WAVEFORMATE
else
length
=
pa_stream_get_buffer_attr
(
stream
)
->
fragsize
;
pa_stream_disconnect
(
stream
);
while
(
pa_mainloop_iterate
(
pulse_
ml
,
1
,
&
ret
)
>=
0
&&
while
(
pa_mainloop_iterate
(
ml
,
1
,
&
ret
)
>=
0
&&
pa_stream_get_state
(
stream
)
==
PA_STREAM_READY
)
{}
}
...
...
@@ -753,31 +754,32 @@ static NTSTATUS pulse_test_connect(void *args)
PhysDevice
*
dev
;
pa_operation
*
o
;
int
ret
;
pa_mainloop
*
ml
;
pa_context
*
ctx
;
pulse_lock
();
pulse_
ml
=
pa_mainloop_new
();
ml
=
pa_mainloop_new
();
pa_mainloop_set_poll_func
(
pulse_
ml
,
pulse_poll_func
,
NULL
);
pa_mainloop_set_poll_func
(
ml
,
pulse_poll_func
,
NULL
);
pulse_ctx
=
pa_context_new
(
pa_mainloop_get_api
(
pulse_
ml
),
params
->
name
);
if
(
!
pulse_
ctx
)
{
ctx
=
pa_context_new
(
pa_mainloop_get_api
(
ml
),
params
->
name
);
if
(
!
ctx
)
{
ERR
(
"Failed to create context
\n
"
);
pa_mainloop_free
(
pulse_ml
);
pulse_ml
=
NULL
;
pa_mainloop_free
(
ml
);
pulse_unlock
();
params
->
result
=
E_FAIL
;
return
STATUS_SUCCESS
;
}
pa_context_set_state_callback
(
pulse_
ctx
,
pulse_contextcallback
,
NULL
);
pa_context_set_state_callback
(
ctx
,
pulse_contextcallback
,
NULL
);
TRACE
(
"libpulse protocol version: %u. API Version %u
\n
"
,
pa_context_get_protocol_version
(
pulse_
ctx
),
PA_API_VERSION
);
if
(
pa_context_connect
(
pulse_
ctx
,
NULL
,
0
,
NULL
)
<
0
)
TRACE
(
"libpulse protocol version: %u. API Version %u
\n
"
,
pa_context_get_protocol_version
(
ctx
),
PA_API_VERSION
);
if
(
pa_context_connect
(
ctx
,
NULL
,
0
,
NULL
)
<
0
)
goto
fail
;
/* Wait for connection */
while
(
pa_mainloop_iterate
(
pulse_
ml
,
1
,
&
ret
)
>=
0
)
{
pa_context_state_t
state
=
pa_context_get_state
(
pulse_
ctx
);
while
(
pa_mainloop_iterate
(
ml
,
1
,
&
ret
)
>=
0
)
{
pa_context_state_t
state
=
pa_context_get_state
(
ctx
);
if
(
state
==
PA_CONTEXT_FAILED
||
state
==
PA_CONTEXT_TERMINATED
)
goto
fail
;
...
...
@@ -786,12 +788,12 @@ static NTSTATUS pulse_test_connect(void *args)
break
;
}
if
(
pa_context_get_state
(
pulse_
ctx
)
!=
PA_CONTEXT_READY
)
if
(
pa_context_get_state
(
ctx
)
!=
PA_CONTEXT_READY
)
goto
fail
;
TRACE
(
"Test-connected to server %s with protocol version: %i.
\n
"
,
pa_context_get_server
(
pulse_
ctx
),
pa_context_get_server_protocol_version
(
pulse_
ctx
));
pa_context_get_server
(
ctx
),
pa_context_get_server_protocol_version
(
ctx
));
free_phys_device_lists
();
list_init
(
&
g_phys_speakers
);
...
...
@@ -800,34 +802,32 @@ static NTSTATUS pulse_test_connect(void *args)
pulse_add_device
(
&
g_phys_speakers
,
NULL
,
0
,
Speakers
,
0
,
""
,
"PulseAudio"
);
pulse_add_device
(
&
g_phys_sources
,
NULL
,
0
,
Microphone
,
0
,
""
,
"PulseAudio"
);
o
=
pa_context_get_sink_info_list
(
pulse_
ctx
,
&
pulse_phys_speakers_cb
,
NULL
);
o
=
pa_context_get_sink_info_list
(
ctx
,
&
pulse_phys_speakers_cb
,
NULL
);
if
(
o
)
{
while
(
pa_mainloop_iterate
(
pulse_
ml
,
1
,
&
ret
)
>=
0
&&
while
(
pa_mainloop_iterate
(
ml
,
1
,
&
ret
)
>=
0
&&
pa_operation_get_state
(
o
)
==
PA_OPERATION_RUNNING
)
{}
pa_operation_unref
(
o
);
}
o
=
pa_context_get_source_info_list
(
pulse_
ctx
,
&
pulse_phys_sources_cb
,
NULL
);
o
=
pa_context_get_source_info_list
(
ctx
,
&
pulse_phys_sources_cb
,
NULL
);
if
(
o
)
{
while
(
pa_mainloop_iterate
(
pulse_
ml
,
1
,
&
ret
)
>=
0
&&
while
(
pa_mainloop_iterate
(
ml
,
1
,
&
ret
)
>=
0
&&
pa_operation_get_state
(
o
)
==
PA_OPERATION_RUNNING
)
{}
pa_operation_unref
(
o
);
}
LIST_FOR_EACH_ENTRY
(
dev
,
&
g_phys_speakers
,
PhysDevice
,
entry
)
{
pulse_probe_settings
(
1
,
dev
->
pulse_name
,
&
dev
->
fmt
,
&
dev
->
def_period
,
&
dev
->
min_period
);
pulse_probe_settings
(
ml
,
ctx
,
1
,
dev
->
pulse_name
,
&
dev
->
fmt
,
&
dev
->
def_period
,
&
dev
->
min_period
);
}
LIST_FOR_EACH_ENTRY
(
dev
,
&
g_phys_sources
,
PhysDevice
,
entry
)
{
pulse_probe_settings
(
0
,
dev
->
pulse_name
,
&
dev
->
fmt
,
&
dev
->
def_period
,
&
dev
->
min_period
);
pulse_probe_settings
(
ml
,
ctx
,
0
,
dev
->
pulse_name
,
&
dev
->
fmt
,
&
dev
->
def_period
,
&
dev
->
min_period
);
}
pa_context_unref
(
pulse_ctx
);
pulse_ctx
=
NULL
;
pa_mainloop_free
(
pulse_ml
);
pulse_ml
=
NULL
;
pa_context_unref
(
ctx
);
pa_mainloop_free
(
ml
);
pulse_unlock
();
...
...
@@ -835,10 +835,8 @@ static NTSTATUS pulse_test_connect(void *args)
return
STATUS_SUCCESS
;
fail:
pa_context_unref
(
pulse_ctx
);
pulse_ctx
=
NULL
;
pa_mainloop_free
(
pulse_ml
);
pulse_ml
=
NULL
;
pa_context_unref
(
ctx
);
pa_mainloop_free
(
ml
);
pulse_unlock
();
params
->
result
=
E_FAIL
;
return
STATUS_SUCCESS
;
...
...
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