[pulseaudio-commits] 2 commits - src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Fri Nov 22 01:40:14 PST 2013
src/pulsecore/card.c | 6 ++++++
src/pulsecore/sink.c | 11 ++++++++++-
src/pulsecore/source.c | 12 +++++++++++-
3 files changed, 27 insertions(+), 2 deletions(-)
New commits:
commit 303cff04eb8c091fb0c7665440797fc56f07d570
Author: Colin Guthrie <colin at mageia.org>
Date: Fri Nov 15 09:33:39 2013 +0100
sink/source: When picking the initial ports, prefer ones that are not unavailable.
This does for sinks/source ports what f434087e42b did for card profiles.
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 81fefbc..95cf9b6 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -304,9 +304,18 @@ pa_sink* pa_sink_new(
void *state;
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)
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)
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 92411de..a6dc9bf 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -292,9 +292,19 @@ pa_source* pa_source_new(
void *state;
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)
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)
commit 84af39f28935d8490aa56bb4782c9fcfd38e6153
Author: Colin Guthrie <colin at mageia.org>
Date: Fri Nov 15 09:33:37 2013 +0100
card: Ensure we still pick a profile even if it's unavailable.
f434087e42b introduced the potential to not select a card profile if
all the profiles were marked as unavailable.
While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.
diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 4ae16c2..03c0bb6 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -202,6 +202,12 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
if (!c->active_profile || profile->priority > c->active_profile->priority)
c->active_profile = profile;
}
+ /* If all profiles are not available, then we still need to pick one */
+ if (!c->active_profile) {
+ PA_HASHMAP_FOREACH(profile, c->profiles, state)
+ if (!c->active_profile || profile->priority > c->active_profile->priority)
+ c->active_profile = profile;
+ }
pa_assert(c->active_profile);
}
More information about the pulseaudio-commits
mailing list