[PATCH v13 9/9] winepulse: Don't probe default devices twice
Claire Girka
wine at gitlab.winehq.org
Wed Jul 6 05:53:42 CDT 2022
From: Claire Girka <claire at sitedethib.com>
Also drop global format and period variables
---
dlls/winepulse.drv/pulse.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index e7a792feca0..652b4f48c72 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -99,10 +99,6 @@ typedef struct _PhysDevice {
static pa_context *pulse_ctx;
static pa_mainloop *pulse_ml;
-/* Mixer format + period times */
-static WAVEFORMATEXTENSIBLE pulse_fmt[2];
-static REFERENCE_TIME pulse_min_period[2], pulse_def_period[2];
-
static struct list g_phys_speakers = LIST_INIT(g_phys_speakers);
static struct list g_phys_sources = LIST_INIT(g_phys_sources);
@@ -801,9 +797,6 @@ static NTSTATUS pulse_test_connect(void *args)
pa_context_get_server(pulse_ctx),
pa_context_get_server_protocol_version(pulse_ctx));
- pulse_probe_settings(1, NULL, &pulse_fmt[0], &pulse_def_period[0], &pulse_min_period[0]);
- pulse_probe_settings(0, NULL, &pulse_fmt[1], &pulse_def_period[1], &pulse_min_period[1]);
-
free_phys_device_lists();
list_init(&g_phys_speakers);
list_init(&g_phys_sources);
@@ -811,6 +804,16 @@ 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");
+ /* Probe the "default" sink and source first to avoid some possible weirdness
+ in PulseAudio's behavior when selecting "default" devices */
+ 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);
+ }
+
+ 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);
+ }
+
o = pa_context_get_sink_info_list(pulse_ctx, &pulse_phys_speakers_cb, NULL);
if (o) {
while (pa_mainloop_iterate(pulse_ml, 1, &ret) >= 0 &&
@@ -828,11 +831,13 @@ static NTSTATUS pulse_test_connect(void *args)
}
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);
+ if (dev->pulse_name[0])
+ pulse_probe_settings(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);
+ if (dev->pulse_name[0])
+ pulse_probe_settings(0, dev->pulse_name, &dev->fmt, &dev->def_period, &dev->min_period);
}
pa_context_unref(pulse_ctx);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/337
More information about the wine-devel
mailing list