[pulseaudio-tickets] [Bug 100451] New: module-switch-on-port-available will only select unavailable ports when a new sink or source appears
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Mar 29 15:33:44 UTC 2017
https://bugs.freedesktop.org/show_bug.cgi?id=100451
Bug ID: 100451
Summary: module-switch-on-port-available will only select
unavailable ports when a new sink or source appears
Product: PulseAudio
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: modules
Assignee: pulseaudio-bugs at lists.freedesktop.org
Reporter: vivek at collabora.co.uk
QA Contact: pulseaudio-bugs at lists.freedesktop.org
CC: lennart at poettering.net
module-switch-on-port-available - the helper function new_sink_source
iterates over the device ports and picks the one with the highest priority
but then, just before returning, does this:
if (p->available != PA_AVAILABLE_NO)
return NULL;
ie the selected port is returned _only_ if it is NOT available.
This logic error appears to be in pulseaudio 10.x also.
This is used by (for example):
static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data
*new_data, void *u) {
pa_device_port *p = new_sink_source(new_data->ports,
new_data->active_port);
if (p) {
pa_log_debug("Switching initial port for sink '%s' to '%s'",
new_data->name, p->name);
pa_sink_new_data_set_port(new_data, p->name);
}
return PA_HOOK_OK;
}
So this module will never choose an available port.
The p->available != PA_AVAILABLE_NO pattern appears all over the place in
this module but I _think_ this is the only place where it's used the
wrong way round.
The following fixed the symptom(s) here (and the pa -vvvv log indicated that
a more sensible set of choices was being made with it applied):
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -256,7 +256,7 @@
p = i;
if (!p)
return NULL;
- if (p->available != PA_AVAILABLE_NO)
+ if (p->available == PA_AVAILABLE_NO)
return NULL;
pa_assert_se(p = find_best_port(ports));
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-bugs/attachments/20170329/9025179d/attachment.html>
More information about the pulseaudio-bugs
mailing list