diff options
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch')
-rw-r--r-- | meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch | 131 |
1 files changed, 67 insertions, 64 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch index 9585f3d529..0e7780154d 100644 --- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch @@ -1,4 +1,4 @@ -From cc41c8a3149ef04d4aa2db3d15032605a5504658 Mon Sep 17 00:00:00 2001 +From 13e85dd1763e99d21a60323671b9a5df08bdae75 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen <tanuk@iki.fi> Date: Fri, 23 Oct 2015 12:59:53 +0300 Subject: [PATCH 3/4] card: move profile selection after pa_card_new() @@ -32,23 +32,30 @@ whether someone else has already set the profile. http://bugzilla.yoctoproject.org/show_bug.cgi?id=8448 -Upstream-Status: Submitted [http://lists.freedesktop.org/archives/pulseaudio-discuss/2015-October/024614.html] Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> + +Rebased on 8.0. + +Upstream-Status: Denied [The patch set needs some work to be accepted. +The review thread: +http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/24301] + +Signed-off-by: Tanu Kaskinen <tanuk@iki.fi> --- - src/modules/alsa/module-alsa-card.c | 19 +++--- - src/modules/bluetooth/module-bluez4-device.c | 18 +++--- + src/modules/alsa/module-alsa-card.c | 19 +++---- + src/modules/bluetooth/module-bluez4-device.c | 18 +++---- src/modules/bluetooth/module-bluez5-device.c | 1 + src/modules/macosx/module-coreaudio-device.c | 1 + - src/modules/module-card-restore.c | 24 ++++---- - src/pulsecore/card.c | 86 +++++++++++++++------------- + src/modules/module-card-restore.c | 24 +++++---- + src/pulsecore/card.c | 81 +++++++++++++++------------- src/pulsecore/card.h | 7 +++ - 7 files changed, 87 insertions(+), 69 deletions(-) + 7 files changed, 86 insertions(+), 65 deletions(-) diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c -index 32f517e..5b39654 100644 +index 9e8cde2..fe240f0 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c -@@ -754,15 +754,6 @@ int pa__init(pa_module *m) { +@@ -770,15 +770,6 @@ int pa__init(pa_module *m) { goto fail; } @@ -64,7 +71,7 @@ index 32f517e..5b39654 100644 u->card = pa_card_new(m->core, &data); pa_card_new_data_done(&data); -@@ -773,6 +764,16 @@ int pa__init(pa_module *m) { +@@ -789,6 +780,16 @@ int pa__init(pa_module *m) { u->card->set_profile = card_set_profile; init_jacks(u); @@ -82,10 +89,10 @@ index 32f517e..5b39654 100644 init_eld_ctls(u); diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c -index 94e6988..5efc5dc 100644 +index dd18217..5d0d3db 100644 --- a/src/modules/bluetooth/module-bluez4-device.c +++ b/src/modules/bluetooth/module-bluez4-device.c -@@ -2307,15 +2307,6 @@ static int add_card(struct userdata *u) { +@@ -2304,15 +2304,6 @@ static int add_card(struct userdata *u) { *d = PA_BLUEZ4_PROFILE_OFF; pa_hashmap_put(data.profiles, p->name, p); @@ -101,7 +108,7 @@ index 94e6988..5efc5dc 100644 u->card = pa_card_new(u->core, &data); pa_card_new_data_done(&data); -@@ -2326,6 +2317,15 @@ static int add_card(struct userdata *u) { +@@ -2323,6 +2314,15 @@ static int add_card(struct userdata *u) { u->card->userdata = u; u->card->set_profile = card_set_profile; @@ -118,7 +125,7 @@ index 94e6988..5efc5dc 100644 d = PA_CARD_PROFILE_DATA(u->card->active_profile); diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c -index 3321785..0081a21 100644 +index b015c67..7b90a31 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -1959,6 +1959,7 @@ static int add_card(struct userdata *u) { @@ -130,10 +137,10 @@ index 3321785..0081a21 100644 p = PA_CARD_PROFILE_DATA(u->card->active_profile); u->profile = *p; diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c -index 4bbb5d5..41f151f 100644 +index 0c92d42..7190ee9 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c -@@ -764,6 +764,7 @@ int pa__init(pa_module *m) { +@@ -807,6 +807,7 @@ int pa__init(pa_module *m) { pa_card_new_data_done(&card_new_data); u->card->userdata = u; u->card->set_profile = card_set_profile; @@ -142,10 +149,10 @@ index 4bbb5d5..41f151f 100644 u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c -index baa2f4f..0501ac8 100644 +index f906843..dce6674 100644 --- a/src/modules/module-card-restore.c +++ b/src/modules/module-card-restore.c -@@ -485,34 +485,38 @@ static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port * +@@ -515,34 +515,38 @@ static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port * return PA_HOOK_OK; } @@ -189,24 +196,24 @@ index baa2f4f..0501ac8 100644 + pa_log_info("Restoring port latency offsets for card %s.", card->name); PA_HASHMAP_FOREACH(p_info, e->ports, state) -- if ((p = pa_hashmap_get(new_data->ports, p_info->name))) -+ if ((p = pa_hashmap_get(card->ports, p_info->name))) +- if ((p = pa_hashmap_get(new_data->ports, p_info->name))) { ++ if ((p = pa_hashmap_get(card->ports, p_info->name))) { p->latency_offset = p_info->offset; - - entry_free(e); + if (!p->preferred_profile && p_info->profile) + pa_device_port_set_preferred_profile(p, p_info->profile); diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c -index cc4c784..1b7f71b 100644 +index f92ac87..1a6e705 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c -@@ -151,6 +151,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { +@@ -148,6 +148,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { pa_assert(!pa_hashmap_isempty(data->profiles)); - c = pa_xnew(pa_card, 1); + c = pa_xnew0(pa_card, 1); + c->state = PA_CARD_STATE_INIT; if (!(name = pa_namereg_register(core, data->name, PA_NAMEREG_CARD, c, data->namereg_fail))) { pa_xfree(c); -@@ -159,12 +160,6 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { +@@ -156,12 +157,6 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { pa_card_new_data_set_name(data, name); @@ -219,22 +226,24 @@ index cc4c784..1b7f71b 100644 c->core = core; c->name = pa_xstrdup(data->name); c->proplist = pa_proplist_copy(data->proplist); -@@ -187,30 +182,6 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { +@@ -184,38 +179,43 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { PA_HASHMAP_FOREACH(port, c->ports, state) port->card = c; -- c->active_profile = NULL; -- c->save_profile = false; -- - if (data->active_profile) - if ((c->active_profile = pa_hashmap_get(c->profiles, data->active_profile))) - c->save_profile = data->save_profile; -- ++ pa_device_init_description(c->proplist, c); ++ pa_device_init_icon(c->proplist, true); ++ pa_device_init_intended_roles(c->proplist); + - if (!c->active_profile) { - PA_HASHMAP_FOREACH(profile, c->profiles, state) { - if (profile->available == PA_AVAILABLE_NO) - continue; -- ++ return c; ++} + - if (!c->active_profile || profile->priority > c->active_profile->priority) - c->active_profile = profile; - } @@ -245,27 +254,10 @@ index cc4c784..1b7f71b 100644 - c->active_profile = profile; - } - pa_assert(c->active_profile); -- } -- - c->userdata = NULL; - c->set_profile = NULL; - c->active_profile = NULL; -@@ -219,13 +190,39 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { - pa_device_init_icon(c->proplist, true); - pa_device_init_intended_roles(c->proplist); - -- pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0); -+ return c; -+} - -- pa_log_info("Created %u \"%s\"", c->index, c->name); -- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, c->index); +void pa_card_put(pa_card *card) { + pa_card_profile *profile; + void *state; - -- pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_PUT], c); -- return c; ++ + pa_assert(card); + + PA_HASHMAP_FOREACH(profile, card->profiles, state) { @@ -274,8 +266,11 @@ index cc4c784..1b7f71b 100644 + + if (!card->active_profile || profile->priority > card->active_profile->priority) + card->active_profile = profile; -+ } -+ + } + +- pa_device_init_description(c->proplist, c); +- pa_device_init_icon(c->proplist, true); +- pa_device_init_intended_roles(c->proplist); + /* If all profiles are unavailable, then we still need to pick one */ + if (!card->active_profile) { + PA_HASHMAP_FOREACH(profile, card->profiles, state) @@ -283,19 +278,24 @@ index cc4c784..1b7f71b 100644 + card->active_profile = profile; + } + pa_assert(card->active_profile); -+ + +- pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0); + pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_NEW], card); -+ + +- pa_log_info("Created %u \"%s\"", c->index, c->name); +- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, c->index); + pa_assert_se(pa_idxset_put(card->core->cards, card, &card->index) >= 0); + card->state = PA_CARD_STATE_LINKED; -+ + +- pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_PUT], c); +- return c; + pa_log_info("Created %u \"%s\"", card->index, card->name); + pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_PUT], card); + pa_subscription_post(card->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, card->index); } void pa_card_free(pa_card *c) { -@@ -292,17 +289,24 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) { +@@ -306,20 +306,27 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) { return 0; } @@ -317,6 +317,9 @@ index cc4c784..1b7f71b 100644 c->active_profile = profile; c->save_profile = save; + if (save) + update_port_preferred_profile(c); + - pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c); + if (c->state != PA_CARD_STATE_INIT) { + pa_log_info("Changed profile of card %u \"%s\" to %s", c->index, c->name, profile->name); @@ -327,22 +330,22 @@ index cc4c784..1b7f71b 100644 return 0; } diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h -index 1c33958..dbbc1c2 100644 +index fff9057..a944301 100644 --- a/src/pulsecore/card.h +++ b/src/pulsecore/card.h -@@ -37,6 +37,11 @@ typedef enum pa_available { - #include <pulsecore/module.h> - #include <pulsecore/idxset.h> +@@ -34,6 +34,11 @@ typedef enum pa_available { + PA_AVAILABLE_YES = 2, + } pa_available_t; +typedef enum pa_card_state { + PA_CARD_STATE_INIT, + PA_CARD_STATE_LINKED, +} pa_card_state_t; + - typedef struct pa_card_profile { + struct pa_card_profile { pa_card *card; char *name; -@@ -61,6 +66,7 @@ typedef struct pa_card_profile { +@@ -66,6 +71,7 @@ struct pa_card_profile { struct pa_card { uint32_t index; @@ -350,7 +353,7 @@ index 1c33958..dbbc1c2 100644 pa_core *core; char *name; -@@ -115,6 +121,7 @@ void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile); +@@ -120,6 +126,7 @@ void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile); void pa_card_new_data_done(pa_card_new_data *data); pa_card *pa_card_new(pa_core *c, pa_card_new_data *data); @@ -359,5 +362,5 @@ index 1c33958..dbbc1c2 100644 void pa_card_add_profile(pa_card *c, pa_card_profile *profile); -- -2.1.4 +2.7.0 |