mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
sink/source: When picking the initial ports, prefer ones that are not unavailable.
This does for sinks/source ports what f434087e42 did for card profiles.
This commit is contained in:
parent
84af39f289
commit
303cff04eb
2 changed files with 21 additions and 2 deletions
|
|
@ -304,9 +304,18 @@ pa_sink* pa_sink_new(
|
||||||
void *state;
|
void *state;
|
||||||
pa_device_port *p;
|
pa_device_port *p;
|
||||||
|
|
||||||
PA_HASHMAP_FOREACH(p, s->ports, state)
|
PA_HASHMAP_FOREACH(p, s->ports, state) {
|
||||||
|
if (p->available == PA_AVAILABLE_NO)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!s->active_port || p->priority > s->active_port->priority)
|
if (!s->active_port || p->priority > s->active_port->priority)
|
||||||
s->active_port = p;
|
s->active_port = p;
|
||||||
|
}
|
||||||
|
if (!s->active_port) {
|
||||||
|
PA_HASHMAP_FOREACH(p, s->ports, state)
|
||||||
|
if (!s->active_port || p->priority > s->active_port->priority)
|
||||||
|
s->active_port = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->active_port)
|
if (s->active_port)
|
||||||
|
|
|
||||||
|
|
@ -292,9 +292,19 @@ pa_source* pa_source_new(
|
||||||
void *state;
|
void *state;
|
||||||
pa_device_port *p;
|
pa_device_port *p;
|
||||||
|
|
||||||
PA_HASHMAP_FOREACH(p, s->ports, state)
|
PA_HASHMAP_FOREACH(p, s->ports, state) {
|
||||||
|
if (p->available == PA_AVAILABLE_NO)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!s->active_port || p->priority > s->active_port->priority)
|
if (!s->active_port || p->priority > s->active_port->priority)
|
||||||
s->active_port = p;
|
s->active_port = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!s->active_port) {
|
||||||
|
PA_HASHMAP_FOREACH(p, s->ports, state)
|
||||||
|
if (!s->active_port || p->priority > s->active_port->priority)
|
||||||
|
s->active_port = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->active_port)
|
if (s->active_port)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue