summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/pulseaudio
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2017-02-03 09:06:35 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-15 20:06:41 -0800
commit36f6e71ccbba456e706dd7723cb0e69990b6b552 (patch)
tree2c244b1a0b5cb4f9928b1768325f4db40fabca51 /meta/recipes-multimedia/pulseaudio
parent8b4474aa727976bb40ad3115ebe28d6ea81794c2 (diff)
downloadpoky-36f6e71ccbba456e706dd7723cb0e69990b6b552.tar.gz
pulseaudio: 9.0 -> 10.0
Relase notes: https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/10.0/ The checksum of the LICENSE file changed due to some clarifications. There were no changes to the actual licensing terms. The LICENSE variable was not accurate, so I made changes to it. Specifically: * there's no GPL code in PulseAudio so I dropped GPL from the list * the LGPL code allows using later versions of the license rather than limiting to just 2.1 * there are some MIT and BSD licensed bits I added more files to LIC_FILES_CHKSUM to have better coverage of all the differently licensed code. Dropped json-c and gdbm from DEPENDS. The new release doesn't use json-c any more. gdbm isn't used when --with-database=simple is passed to configure, so it should have been removed from DEPENDS a long time ago. The new release dropped the Xen module, so the --without-xen configure option isn't needed any more. Added a comment for why --without-fftw is used. Disabled the adrian echo canceller, because it has an unusual license, and disabling the code was simpler than adding a new license to OE-Core. Dropped upstreamed patches. (From OE-Core rev: 4ddaf28fd36294fd940f26d55973da20eeeeb0d8) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio')
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio.inc80
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio/0001-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch61
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio/0002-card-don-t-allow-the-CARD_NEW-hook-to-fail.patch37
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch429
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio/0004-card-remove-pa_card_new_data.active_profile.patch72
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch79
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb14
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio_9.0.bb19
8 files changed, 88 insertions, 703 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio.inc b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc
index f5c5ed29c9..818ff560cc 100644
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio.inc
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc
@@ -2,16 +2,69 @@ SUMMARY = "Sound server for Linux and Unix-like operating systems"
2HOMEPAGE = "http://www.pulseaudio.org" 2HOMEPAGE = "http://www.pulseaudio.org"
3AUTHOR = "Lennart Poettering" 3AUTHOR = "Lennart Poettering"
4SECTION = "libs/multimedia" 4SECTION = "libs/multimedia"
5LICENSE = "GPLv2+ & LGPLv2.1" 5
6LIC_FILES_CHKSUM = "file://LICENSE;md5=d9ae089c8dc5339f8ac9d8563038a29f \ 6# Most of PulseAudio code is under LGPLv2.1+. There are a few exceptions:
7#
8# The "adrian" echo canceller variant has code under a non-standard permissive
9# license. See src/modules/echo-cancel/adrian-license.txt for details. This
10# recipe disables the adrian echo canceller to avoid hassle with the unusual
11# license.
12#
13# The src/modules/reserve* and src/pulsecore/rtkit* files are under the MIT
14# license.
15#
16# The src/pulsecore/filter/ directory contains code under the 3-clause BSD
17# license.
18#
19# src/utils/qpaeq is licensed under AGPL. qpaeq is not installed by this
20# recipe, however, which is why AGPL is not mentioned in LICENSE.
21#
22# People who distribute PulseAudio binaries need to also consider that there
23# are some dependencies to GPL libraries. LGPL code that depends on GPL
24# libraries probably becomes effectively GPL-licensed (at compile-time? or at
25# at link-time?). I'm not a lawyer, though, so I'm not sure of the exact
26# implications. The GPL dependencies only affect the server, not the client
27# library, with the exception of libdbus that affects both. These are the GPL
28# library dependencies:
29#
30# One of the resampler implementations uses libsamplerate. This recipe doesn't
31# enable that resampler, however.
32#
33# One of the database implementations uses gdbm. This recipe doesn't enable
34# that database implementation, however.
35#
36# module-lirc (enabled by PACKAGECONFIG[lirc]) uses LIRC.
37#
38# module-equalizer-sink uses FFTW. This recipe disables that, however.
39#
40# The dependency with the most complicated licensing considerations is libdbus.
41# When PACKAGECONFIG[dbus] is enabled (like it is by default), libdbus will be
42# used by both the server and the client library (libpulse). Does this affect
43# applications that use libpulse? It should be also noted that libdbus is
44# dual-licensed: either GPLv2+ or AFL-2 terms apply. Whose decision is it which
45# of the licenses apply? What a mess. Some people hold the view that libdbus is
46# a system library that is covered by the "special exception" in GPLv2's
47# section 3, and therefore libdbus's GPL license doesn't affect PulseAudio.
48LICENSE = "LGPLv2.1+ & MIT & BSD-3-Clause"
49
50LIC_FILES_CHKSUM = "file://LICENSE;md5=a848e8d03f04976778eab2348b59ed2b \
7 file://GPL;md5=4325afd396febcb659c36b49533135d4 \ 51 file://GPL;md5=4325afd396febcb659c36b49533135d4 \
8 file://LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \ 52 file://LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \
9 file://src/pulsecore/resampler.h;beginline=4;endline=21;md5=09794012ae16912c0270f3280cc8ff84" 53 file://AGPL;md5=73f1eb20517c55bf9493b7dd6e480788 \
54 file://src/modules/echo-cancel/adrian-license.txt;md5=abbab006a561fbffccedf1c3531f34ab \
55 file://src/pulsecore/filter/LICENSE.WEBKIT;md5=49defbaffddf8c51faf606ff7fc3b1f7 \
56 file://src/pulsecore/resampler.h;beginline=4;endline=21;md5=09794012ae16912c0270f3280cc8ff84 \
57 file://src/modules/reserve.h;beginline=6;endline=28;md5=0e23094760367d51b6609750e9b31fbb \
58 file://src/pulsecore/rtkit.h;beginline=6;endline=29;md5=3f00ff966716ae0817c31576d1473528 \
59 file://src/utils/qpaeq;beginline=2;endline=16;md5=7f62515a4762f0c3fc3d4201858bb964 \
60 file://src/modules/echo-cancel/adrian-aec.h;beginline=3;endline=12;md5=d3ed4fad1c073f8b06f37495dc5d1026 \
61 file://src/pulsecore/filter/biquad.h;beginline=1;endline=4;md5=6d46d1365206528a20137355924233c1 \
62"
10 63
11DEPENDS = "libatomic-ops libsndfile1 libtool intltool-native" 64DEPENDS = "libatomic-ops libsndfile1 libtool intltool-native"
12# optional 65# optional
13DEPENDS += "udev alsa-lib glib-2.0 gconf" 66DEPENDS += "udev alsa-lib glib-2.0 gconf"
14DEPENDS += "json-c gdbm speexdsp libxml-parser-perl-native libcap" 67DEPENDS += "speexdsp libxml-parser-perl-native libcap"
15 68
16inherit autotools bash-completion pkgconfig useradd gettext perlnative bluetooth systemd manpages 69inherit autotools bash-completion pkgconfig useradd gettext perlnative bluetooth systemd manpages
17 70
@@ -25,9 +78,7 @@ EXTRA_OECONF = "\
25 --enable-tcpwrap=no \ 78 --enable-tcpwrap=no \
26 --with-access-group=audio \ 79 --with-access-group=audio \
27 --disable-openssl \ 80 --disable-openssl \
28 --disable-xen \
29 --with-database=simple \ 81 --with-database=simple \
30 --without-fftw \
31 --without-zsh-completion-dir \ 82 --without-zsh-completion-dir \
32 --with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d \ 83 --with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d \
33 ac_cv_header_valgrind_memcheck_h=no \ 84 ac_cv_header_valgrind_memcheck_h=no \
@@ -38,6 +89,23 @@ EXTRA_OECONF = "\
38# oe-core nor meta-oe, so let's not add a PACKAGECONFIG entry for it for now. 89# oe-core nor meta-oe, so let's not add a PACKAGECONFIG entry for it for now.
39EXTRA_OECONF += "--without-soxr" 90EXTRA_OECONF += "--without-soxr"
40 91
92# The FFTW dependency (for module-equalizer-sink) was removed in commit
93# ddbd713293 without explaining why it was not made a PACKAGECONFIG item
94# instead. Oh well, let's keep it disabled until someone expresses some
95# interest in having it enabled.
96#
97# One nice thing about disabling this is that it also prevents qpaeq from
98# being installed, so we avoid adding AGPL to the list of licenses (nothing
99# else in PulseAudio is licensed under AGPL).
100EXTRA_OECONF += "--without-fftw"
101
102# The "adrian" echo canceller implementation has a non-standard license
103# (src/modules/echo-cancel/adrian-license.txt). It's a permissive license, so
104# the licensing terms are probably not problematic, but it would be an extra
105# hassle to add the license to OE-Core's set of licenses. The canceller isn't
106# very good anyway, better alternatives exist (such as the webrtc canceller).
107EXTRA_OECONF += "--disable-adrian-aec"
108
41PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)} \ 109PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)} \
42 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \ 110 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
43 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \ 111 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch
deleted file mode 100644
index 2f72ceb33b..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1From 9c3cdfcd198ef9727ea542f284ac6d8c1bcd7a3a Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Fri, 23 Oct 2015 12:36:34 +0300
4Subject: [PATCH 1/5] alsa, bluetooth: fail if user-requested profile doesn't
5 exist
6
7If we can't fulfill the user request fully, I think we shouldn't
8fulfill it at all, to make it clear that the requested operation
9didn't succeed.
10
11Upstream-Status: Accepted [expected in 10.0]
12
13Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
14---
15 src/modules/alsa/module-alsa-card.c | 11 +++++++++--
16 src/modules/bluetooth/module-bluez4-device.c | 7 +++++--
17 2 files changed, 14 insertions(+), 4 deletions(-)
18
19diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
20index e5cc4ae..d761683 100644
21--- a/src/modules/alsa/module-alsa-card.c
22+++ b/src/modules/alsa/module-alsa-card.c
23@@ -799,8 +799,15 @@ int pa__init(pa_module *m) {
24 goto fail;
25 }
26
27- if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
28- pa_card_new_data_set_profile(&data, profile);
29+ if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
30+ if (pa_hashmap_get(data.profiles, profile))
31+ pa_card_new_data_set_profile(&data, profile);
32+ else {
33+ pa_log("No such profile: %s", profile);
34+ pa_card_new_data_done(&data);
35+ goto fail;
36+ }
37+ }
38
39 u->card = pa_card_new(m->core, &data);
40 pa_card_new_data_done(&data);
41diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
42index 9a921a5..a2de525 100644
43--- a/src/modules/bluetooth/module-bluez4-device.c
44+++ b/src/modules/bluetooth/module-bluez4-device.c
45@@ -2301,8 +2301,11 @@ static int add_card(struct userdata *u) {
46 if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
47 if (pa_hashmap_get(data.profiles, default_profile))
48 pa_card_new_data_set_profile(&data, default_profile);
49- else
50- pa_log_warn("Profile '%s' not valid or not supported by device.", default_profile);
51+ else {
52+ pa_log("Profile '%s' not valid or not supported by device.", default_profile);
53+ pa_card_new_data_done(&data);
54+ return -1;
55+ }
56 }
57
58 u->card = pa_card_new(u->core, &data);
59--
602.8.1
61
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-card-don-t-allow-the-CARD_NEW-hook-to-fail.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-card-don-t-allow-the-CARD_NEW-hook-to-fail.patch
deleted file mode 100644
index 80c291f821..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-card-don-t-allow-the-CARD_NEW-hook-to-fail.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From d4e6d07fef28d1bd8bfbceab4cc196ef54c23dd8 Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Tue, 7 Jun 2016 16:51:00 +0300
4Subject: [PATCH 2/5] card: don't allow the CARD_NEW hook to fail
5
6There is currently no use for allowing modules to cancel card creation,
7and I don't see need for that in the future either. Let's simplify
8things by removing the failure handling code.
9
10Upstream-Status: Accepted [expected in 10.0]
11
12Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
13---
14 src/pulsecore/card.c | 7 +------
15 1 file changed, 1 insertion(+), 6 deletions(-)
16
17diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
18index 410746b..0ac70b9 100644
19--- a/src/pulsecore/card.c
20+++ b/src/pulsecore/card.c
21@@ -149,12 +149,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
22 }
23
24 pa_card_new_data_set_name(data, name);
25-
26- if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_NEW], data) < 0) {
27- pa_xfree(c);
28- pa_namereg_unregister(core, name);
29- return NULL;
30- }
31+ pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_NEW], data);
32
33 c->core = core;
34 c->name = pa_xstrdup(data->name);
35--
362.8.1
37
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
deleted file mode 100644
index e0f424bbcc..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0003-card-move-profile-selection-after-pa_card_new.patch
+++ /dev/null
@@ -1,429 +0,0 @@
1From 0b98309fdbcd36fa92ab53e33c51b485b905e294 Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Fri, 23 Oct 2015 12:59:53 +0300
4Subject: [PATCH 3/5] card: move profile selection after pa_card_new()
5
6I want module-alsa-card to set the availability of unavailable
7profiles before the initial card profile gets selected, so that the
8selection logic can use correct availability information.
9module-alsa-card initializes the jack state after calling
10pa_card_new(), however, and the profile selection happens in
11pa_card_new(). This patch solves that by moving parts of pa_card_new()
12to pa_card_choose_initial_profile() and pa_card_put().
13
14pa_card_choose_initial_profile() applies the profile selection policy,
15so module-alsa-card can first call pa_card_new(), then initialize the
16jack state, and then call pa_card_choose_initial_profile(). After that
17module-alsa-card can still override the profile selection policy, in
18case module-alsa-card was loaded with the "profile" argument. Finally,
19pa_card_put() finalizes the card creation.
20
21An alternative solution would have been to move the jack
22initialization to happen before pa_card_new() and use pa_card_new_data
23instead of pa_card in the jack initialization code, but I disliked
24that idea (I want to get rid of the "new data" pattern eventually).
25
26The order in which the initial profile policy is applied is reversed
27in this patch. Previously the first one to set it won, now the last
28one to set it wins. I think this is better, because if you have N
29parties that want to set the profile, we avoid checking N times
30whether someone else has already set the profile.
31
32Upstream-Status: Accepted [expected in 10.0]
33
34Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
35---
36 src/modules/alsa/module-alsa-card.c | 32 +++++----
37 src/modules/bluetooth/module-bluez4-device.c | 31 +++++----
38 src/modules/bluetooth/module-bluez5-device.c | 2 +
39 src/modules/macosx/module-coreaudio-device.c | 2 +
40 src/modules/module-card-restore.c | 36 +++++++---
41 src/pulsecore/card.c | 99 +++++++++++++++++-----------
42 src/pulsecore/card.h | 9 +++
43 src/pulsecore/core.h | 1 +
44 8 files changed, 143 insertions(+), 69 deletions(-)
45
46diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
47index d761683..1976230 100644
48--- a/src/modules/alsa/module-alsa-card.c
49+++ b/src/modules/alsa/module-alsa-card.c
50@@ -671,7 +671,7 @@ int pa__init(pa_module *m) {
51 struct userdata *u;
52 pa_reserve_wrapper *reserve = NULL;
53 const char *description;
54- const char *profile = NULL;
55+ const char *profile_str = NULL;
56 char *fn = NULL;
57 bool namereg_fail = false;
58
59@@ -799,16 +799,6 @@ int pa__init(pa_module *m) {
60 goto fail;
61 }
62
63- if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
64- if (pa_hashmap_get(data.profiles, profile))
65- pa_card_new_data_set_profile(&data, profile);
66- else {
67- pa_log("No such profile: %s", profile);
68- pa_card_new_data_done(&data);
69- goto fail;
70- }
71- }
72-
73 u->card = pa_card_new(m->core, &data);
74 pa_card_new_data_done(&data);
75
76@@ -822,6 +812,26 @@ int pa__init(pa_module *m) {
77 (pa_hook_cb_t) card_suspend_changed, u);
78
79 init_jacks(u);
80+
81+ pa_card_choose_initial_profile(u->card);
82+
83+ /* If the "profile" modarg is given, we have to override whatever the usual
84+ * policy chose in pa_card_choose_initial_profile(). */
85+ profile_str = pa_modargs_get_value(u->modargs, "profile", NULL);
86+ if (profile_str) {
87+ pa_card_profile *profile;
88+
89+ profile = pa_hashmap_get(u->card->profiles, profile_str);
90+ if (!profile) {
91+ pa_log("No such profile: %s", profile_str);
92+ goto fail;
93+ }
94+
95+ pa_card_set_profile(u->card, profile, false);
96+ }
97+
98+ pa_card_put(u->card);
99+
100 init_profile(u);
101 init_eld_ctls(u);
102
103diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
104index a2de525..13fb7ab 100644
105--- a/src/modules/bluetooth/module-bluez4-device.c
106+++ b/src/modules/bluetooth/module-bluez4-device.c
107@@ -2238,7 +2238,7 @@ static int add_card(struct userdata *u) {
108 pa_bluez4_profile_t *d;
109 pa_bluez4_form_factor_t ff;
110 char *n;
111- const char *default_profile;
112+ const char *profile_str;
113 const pa_bluez4_device *device;
114 const pa_bluez4_uuid *uuid;
115
116@@ -2298,16 +2298,6 @@ static int add_card(struct userdata *u) {
117 *d = PA_BLUEZ4_PROFILE_OFF;
118 pa_hashmap_put(data.profiles, p->name, p);
119
120- if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
121- if (pa_hashmap_get(data.profiles, default_profile))
122- pa_card_new_data_set_profile(&data, default_profile);
123- else {
124- pa_log("Profile '%s' not valid or not supported by device.", default_profile);
125- pa_card_new_data_done(&data);
126- return -1;
127- }
128- }
129-
130 u->card = pa_card_new(u->core, &data);
131 pa_card_new_data_done(&data);
132
133@@ -2319,6 +2309,25 @@ static int add_card(struct userdata *u) {
134 u->card->userdata = u;
135 u->card->set_profile = card_set_profile;
136
137+ pa_card_choose_initial_profile(u->card);
138+
139+ /* If the "profile" modarg is given, we have to override whatever the usual
140+ * policy chose in pa_card_choose_initial_profile(). */
141+ profile_str = pa_modargs_get_value(u->modargs, "profile", NULL);
142+ if (profile_str) {
143+ pa_card_profile *profile;
144+
145+ profile = pa_hashmap_get(u->card->profiles, profile_str);
146+ if (!profile) {
147+ pa_log("No such profile: %s", profile_str);
148+ return -1;
149+ }
150+
151+ pa_card_set_profile(u->card, profile, false);
152+ }
153+
154+ pa_card_put(u->card);
155+
156 d = PA_CARD_PROFILE_DATA(u->card->active_profile);
157
158 if (*d != PA_BLUEZ4_PROFILE_OFF && (!device->transports[*d] ||
159diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
160index 84e6d55..498d0e1 100644
161--- a/src/modules/bluetooth/module-bluez5-device.c
162+++ b/src/modules/bluetooth/module-bluez5-device.c
163@@ -1953,6 +1953,8 @@ static int add_card(struct userdata *u) {
164
165 u->card->userdata = u;
166 u->card->set_profile = set_profile_cb;
167+ pa_card_choose_initial_profile(u->card);
168+ pa_card_put(u->card);
169
170 p = PA_CARD_PROFILE_DATA(u->card->active_profile);
171 u->profile = *p;
172diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
173index 6c9e55d..d91c656 100644
174--- a/src/modules/macosx/module-coreaudio-device.c
175+++ b/src/modules/macosx/module-coreaudio-device.c
176@@ -821,6 +821,8 @@ int pa__init(pa_module *m) {
177 pa_card_new_data_done(&card_new_data);
178 u->card->userdata = u;
179 u->card->set_profile = card_set_profile;
180+ pa_card_choose_initial_profile(u->card);
181+ pa_card_put(u->card);
182
183 u->rtpoll = pa_rtpoll_new();
184 pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
185diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
186index 7545aa5..718a0dd 100644
187--- a/src/modules/module-card-restore.c
188+++ b/src/modules/module-card-restore.c
189@@ -551,16 +551,6 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new
190 if (!(e = entry_read(u, new_data->name)))
191 return PA_HOOK_OK;
192
193- if (e->profile[0]) {
194- if (!new_data->active_profile) {
195- pa_card_new_data_set_profile(new_data, e->profile);
196- pa_log_info("Restored profile '%s' for card %s.", new_data->active_profile, new_data->name);
197- new_data->save_profile = true;
198-
199- } else
200- pa_log_debug("Not restoring profile for card %s, because already set.", new_data->name);
201- }
202-
203 /* Always restore the latency offsets because their
204 * initial value is always 0 */
205
206@@ -590,6 +580,30 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new
207 return PA_HOOK_OK;
208 }
209
210+static pa_hook_result_t card_choose_initial_profile_callback(pa_core *core, pa_card *card, struct userdata *u) {
211+ struct entry *e;
212+
213+ if (!(e = entry_read(u, card->name)))
214+ return PA_HOOK_OK;
215+
216+ if (e->profile[0]) {
217+ pa_card_profile *profile;
218+
219+ profile = pa_hashmap_get(card->profiles, e->profile);
220+ if (profile) {
221+ pa_log_info("Restoring profile '%s' for card %s.", card->active_profile->name, card->name);
222+ pa_card_set_profile(card, profile, true);
223+ } else {
224+ pa_log_debug("Tried to restore profile %s for card %s, but the card doesn't have such profile.",
225+ e->profile, card->name);
226+ }
227+ }
228+
229+ entry_free(e);
230+
231+ return PA_HOOK_OK;
232+}
233+
234 static pa_hook_result_t card_preferred_port_changed_callback(pa_core *core, pa_card_preferred_port_changed_hook_data *data,
235 struct userdata *u) {
236 struct entry *e;
237@@ -634,6 +648,8 @@ int pa__init(pa_module*m) {
238 u->module = m;
239
240 pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_NEW], PA_HOOK_EARLY, (pa_hook_cb_t) card_new_hook_callback, u);
241+ pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], PA_HOOK_NORMAL,
242+ (pa_hook_cb_t) card_choose_initial_profile_callback, u);
243 pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) card_put_hook_callback, u);
244 pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PREFERRED_PORT_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_preferred_port_changed_callback, u);
245 pa_module_hook_connect(m, &m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_profile_changed_callback, u);
246diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
247index 0ac70b9..a0c3d93 100644
248--- a/src/pulsecore/card.c
249+++ b/src/pulsecore/card.c
250@@ -176,38 +176,56 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
251 c->preferred_input_port = data->preferred_input_port;
252 c->preferred_output_port = data->preferred_output_port;
253
254- if (data->active_profile)
255- if ((c->active_profile = pa_hashmap_get(c->profiles, data->active_profile)))
256- c->save_profile = data->save_profile;
257+ pa_device_init_description(c->proplist, c);
258+ pa_device_init_icon(c->proplist, true);
259+ pa_device_init_intended_roles(c->proplist);
260
261- if (!c->active_profile) {
262- PA_HASHMAP_FOREACH(profile, c->profiles, state) {
263- if (profile->available == PA_AVAILABLE_NO)
264- continue;
265+ return c;
266+}
267
268- if (!c->active_profile || profile->priority > c->active_profile->priority)
269- c->active_profile = profile;
270- }
271- /* If all profiles are not available, then we still need to pick one */
272- if (!c->active_profile) {
273- PA_HASHMAP_FOREACH(profile, c->profiles, state)
274- if (!c->active_profile || profile->priority > c->active_profile->priority)
275- c->active_profile = profile;
276+void pa_card_choose_initial_profile(pa_card *card) {
277+ pa_card_profile *profile;
278+ void *state;
279+ pa_card_profile *best = NULL;
280+
281+ pa_assert(card);
282+
283+ /* By default, pick the highest priority profile that is not unavailable,
284+ * or if all profiles are unavailable, pick the profile with the highest
285+ * priority regardless of its availability. */
286+
287+ PA_HASHMAP_FOREACH(profile, card->profiles, state) {
288+ if (profile->available == PA_AVAILABLE_NO)
289+ continue;
290+
291+ if (!best || profile->priority > best->priority)
292+ best = profile;
293+ }
294+
295+ if (!best) {
296+ PA_HASHMAP_FOREACH(profile, card->profiles, state) {
297+ if (!best || profile->priority > best->priority)
298+ best = profile;
299 }
300- pa_assert(c->active_profile);
301 }
302+ pa_assert(best);
303
304- pa_device_init_description(c->proplist, c);
305- pa_device_init_icon(c->proplist, true);
306- pa_device_init_intended_roles(c->proplist);
307+ card->active_profile = best;
308+ card->save_profile = false;
309
310- pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0);
311+ /* Let policy modules override the default. */
312+ pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], card);
313+}
314
315- pa_log_info("Created %u \"%s\"", c->index, c->name);
316- pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, c->index);
317+void pa_card_put(pa_card *card) {
318+ pa_assert(card);
319
320- pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_PUT], c);
321- return c;
322+ pa_assert_se(pa_idxset_put(card->core->cards, card, &card->index) >= 0);
323+ card->linked = true;
324+
325+ pa_log_info("Created %u \"%s\"", card->index, card->name);
326+ pa_hook_fire(&card->core->hooks[PA_CORE_HOOK_CARD_PUT], card);
327+ pa_subscription_post(card->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, card->index);
328 }
329
330 void pa_card_free(pa_card *c) {
331@@ -218,15 +236,15 @@ void pa_card_free(pa_card *c) {
332
333 core = c->core;
334
335- pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_UNLINK], c);
336-
337- pa_namereg_unregister(core, c->name);
338-
339- pa_idxset_remove_by_data(c->core->cards, c, NULL);
340+ if (c->linked) {
341+ pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_UNLINK], c);
342
343- pa_log_info("Freed %u \"%s\"", c->index, c->name);
344+ pa_idxset_remove_by_data(c->core->cards, c, NULL);
345+ pa_log_info("Freed %u \"%s\"", c->index, c->name);
346+ pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
347+ }
348
349- pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
350+ pa_namereg_unregister(core, c->name);
351
352 pa_assert(pa_idxset_isempty(c->sinks));
353 pa_idxset_free(c->sinks, NULL);
354@@ -298,20 +316,27 @@ int pa_card_set_profile(pa_card *c, pa_card_profile *profile, bool save) {
355 return 0;
356 }
357
358- if ((r = c->set_profile(c, profile)) < 0)
359+ /* If we're setting the initial profile, we shouldn't call set_profile(),
360+ * because the implementations don't expect that (for historical reasons).
361+ * We should just set c->active_profile, and the implementations will
362+ * properly set up that profile after pa_card_put() has returned. It would
363+ * be probably good to change this so that also the initial profile can be
364+ * set up in set_profile(), but if set_profile() fails, that would need
365+ * some better handling than what we do here currently. */
366+ if (c->linked && (r = c->set_profile(c, profile)) < 0)
367 return r;
368
369- pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
370-
371- pa_log_info("Changed profile of card %u \"%s\" to %s", c->index, c->name, profile->name);
372-
373 c->active_profile = profile;
374 c->save_profile = save;
375
376 if (save)
377 update_port_preferred_profile(c);
378
379- pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c);
380+ if (c->linked) {
381+ pa_log_info("Changed profile of card %u \"%s\" to %s", c->index, c->name, profile->name);
382+ pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], c);
383+ pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
384+ }
385
386 return 0;
387 }
388diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h
389index d4970e3..fd1fe0a 100644
390--- a/src/pulsecore/card.h
391+++ b/src/pulsecore/card.h
392@@ -86,6 +86,8 @@ struct pa_card {
393
394 pa_suspend_cause_t suspend_cause;
395
396+ bool linked;
397+
398 void *userdata;
399
400 int (*set_profile)(pa_card *c, pa_card_profile *profile);
401@@ -128,6 +130,13 @@ void pa_card_new_data_set_preferred_port(pa_card_new_data *data, pa_direction_t
402 void pa_card_new_data_done(pa_card_new_data *data);
403
404 pa_card *pa_card_new(pa_core *c, pa_card_new_data *data);
405+
406+/* Select the initial card profile according to the configured policies. This
407+ * must be called between pa_card_new() and pa_card_put(), after the port and
408+ * profile availablities have been initialized. */
409+void pa_card_choose_initial_profile(pa_card *card);
410+
411+void pa_card_put(pa_card *c);
412 void pa_card_free(pa_card *c);
413
414 void pa_card_add_profile(pa_card *c, pa_card_profile *profile);
415diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
416index 00d7f2f..802111b 100644
417--- a/src/pulsecore/core.h
418+++ b/src/pulsecore/core.h
419@@ -118,6 +118,7 @@ typedef enum pa_core_hook {
420 PA_CORE_HOOK_CLIENT_PROPLIST_CHANGED,
421 PA_CORE_HOOK_CLIENT_SEND_EVENT,
422 PA_CORE_HOOK_CARD_NEW,
423+ PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE,
424 PA_CORE_HOOK_CARD_PUT,
425 PA_CORE_HOOK_CARD_UNLINK,
426 PA_CORE_HOOK_CARD_PREFERRED_PORT_CHANGED,
427--
4282.8.1
429
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0004-card-remove-pa_card_new_data.active_profile.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0004-card-remove-pa_card_new_data.active_profile.patch
deleted file mode 100644
index 480f2cea41..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0004-card-remove-pa_card_new_data.active_profile.patch
+++ /dev/null
@@ -1,72 +0,0 @@
1From 375bc56fd3d66f40a9650224e5bfea4002494ade Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Fri, 23 Oct 2015 13:50:35 +0300
4Subject: [PATCH 4/5] card: remove pa_card_new_data.active_profile
5
6It's not being used any more.
7
8Upstream-Status: Accepted [expected in 10.0]
9
10Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
11---
12 src/pulsecore/card.c | 8 --------
13 src/pulsecore/card.h | 5 -----
14 2 files changed, 13 deletions(-)
15
16diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
17index a0c3d93..bc5b75b 100644
18--- a/src/pulsecore/card.c
19+++ b/src/pulsecore/card.c
20@@ -96,13 +96,6 @@ void pa_card_new_data_set_name(pa_card_new_data *data, const char *name) {
21 data->name = pa_xstrdup(name);
22 }
23
24-void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile) {
25- pa_assert(data);
26-
27- pa_xfree(data->active_profile);
28- data->active_profile = pa_xstrdup(profile);
29-}
30-
31 void pa_card_new_data_set_preferred_port(pa_card_new_data *data, pa_direction_t direction, pa_device_port *port) {
32 pa_assert(data);
33
34@@ -125,7 +118,6 @@ void pa_card_new_data_done(pa_card_new_data *data) {
35 pa_hashmap_free(data->ports);
36
37 pa_xfree(data->name);
38- pa_xfree(data->active_profile);
39 }
40
41 pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
42diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h
43index fd1fe0a..5699475 100644
44--- a/src/pulsecore/card.h
45+++ b/src/pulsecore/card.h
46@@ -101,15 +101,11 @@ typedef struct pa_card_new_data {
47 pa_module *module;
48
49 pa_hashmap *profiles;
50- char *active_profile;
51-
52 pa_hashmap *ports;
53 pa_device_port *preferred_input_port;
54 pa_device_port *preferred_output_port;
55
56 bool namereg_fail:1;
57-
58- bool save_profile:1;
59 } pa_card_new_data;
60
61 typedef struct {
62@@ -125,7 +121,6 @@ void pa_card_profile_set_available(pa_card_profile *c, pa_available_t available)
63
64 pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data);
65 void pa_card_new_data_set_name(pa_card_new_data *data, const char *name);
66-void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile);
67 void pa_card_new_data_set_preferred_port(pa_card_new_data *data, pa_direction_t direction, pa_device_port *port);
68 void pa_card_new_data_done(pa_card_new_data *data);
69
70--
712.8.1
72
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch
deleted file mode 100644
index 5563d2c352..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From ae6a01ba204b480bda6a5b4431be3d22e53a7006 Mon Sep 17 00:00:00 2001
2From: Tanu Kaskinen <tanuk@iki.fi>
3Date: Fri, 23 Oct 2015 13:37:11 +0300
4Subject: [PATCH 5/5] alsa: set availability for (some) unavailable profiles
5
6The alsa card hasn't so far set any availability for profiles. That
7caused an issue with some HDMI hardware: the sound card has two HDMI
8outputs, but only the second of them is actually usable. The
9unavailable port is marked as unavailable and the available port is
10marked as available, but this information isn't propagated to the
11profile availability. Without profile availability information, the
12initial profile policy picks the unavailable one, since it has a
13higher priority value.
14
15This patch adds simple logic for marking some profiles unavailable:
16if the profile only contains unavailable ports, the profile is
17unavailable too. This can be improved in the future so that if a
18profile contains sinks or sources that only contain unavailable ports,
19the profile should be marked as unavailable. Implementing that
20requires adding more information about the sinks and sources to
21pa_card_profile, however.
22
23BugLink: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8448
24
25Upstream-Status: Accepted [expected in 10.0]
26
27Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
28---
29 src/modules/alsa/module-alsa-card.c | 27 +++++++++++++++++++++++++++
30 1 file changed, 27 insertions(+)
31
32diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
33index 1976230..323e08a 100644
34--- a/src/modules/alsa/module-alsa-card.c
35+++ b/src/modules/alsa/module-alsa-card.c
36@@ -366,6 +366,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
37 void *state;
38 pa_alsa_jack *jack;
39 struct temp_port_avail *tp, *tports;
40+ pa_card_profile *profile;
41
42 pa_assert(u);
43
44@@ -426,6 +427,32 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
45 if (tp->avail == PA_AVAILABLE_NO)
46 pa_device_port_set_available(tp->port, tp->avail);
47
48+ /* Update profile availabilities. The logic could be improved; for now we
49+ * only set obviously unavailable profiles (those that contain only
50+ * unavailable ports) to PA_AVAILABLE_NO and all others to
51+ * PA_AVAILABLE_UNKNOWN. */
52+ PA_HASHMAP_FOREACH(profile, u->card->profiles, state) {
53+ pa_device_port *port;
54+ void *state2;
55+ pa_available_t available = PA_AVAILABLE_NO;
56+
57+ /* Don't touch the "off" profile. */
58+ if (profile->n_sources == 0 && profile->n_sinks == 0)
59+ continue;
60+
61+ PA_HASHMAP_FOREACH(port, u->card->ports, state2) {
62+ if (!pa_hashmap_get(port->profiles, profile->name))
63+ continue;
64+
65+ if (port->available != PA_AVAILABLE_NO) {
66+ available = PA_AVAILABLE_UNKNOWN;
67+ break;
68+ }
69+ }
70+
71+ pa_card_profile_set_available(profile, available);
72+ }
73+
74 pa_xfree(tports);
75 return 0;
76 }
77--
782.8.1
79
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb
new file mode 100644
index 0000000000..f3a85737fc
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_10.0.bb
@@ -0,0 +1,14 @@
1require pulseaudio.inc
2
3SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
4 file://0001-padsp-Make-it-compile-on-musl.patch \
5 file://0001-client-conf-Add-allow-autospawn-for-root.patch \
6 file://volatiles.04_pulse \
7"
8SRC_URI[md5sum] = "4950d2799bf55ab91f6b7f990b7f0971"
9SRC_URI[sha256sum] = "a3186824de9f0d2095ded5d0d0db0405dc73133983c2fbb37291547e37462f57"
10
11do_compile_prepend() {
12 mkdir -p ${S}/libltdl
13 cp ${STAGING_LIBDIR}/libltdl* ${S}/libltdl
14}
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_9.0.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_9.0.bb
deleted file mode 100644
index 00f5442b85..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio_9.0.bb
+++ /dev/null
@@ -1,19 +0,0 @@
1require pulseaudio.inc
2
3SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
4 file://0001-padsp-Make-it-compile-on-musl.patch \
5 file://0001-client-conf-Add-allow-autospawn-for-root.patch \
6 file://0001-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch \
7 file://0002-card-don-t-allow-the-CARD_NEW-hook-to-fail.patch \
8 file://0003-card-move-profile-selection-after-pa_card_new.patch \
9 file://0004-card-remove-pa_card_new_data.active_profile.patch \
10 file://0005-alsa-set-availability-for-some-unavailable-profiles.patch \
11 file://volatiles.04_pulse \
12"
13SRC_URI[md5sum] = "da7162541b3a9bc20576dbd0d7d1489a"
14SRC_URI[sha256sum] = "c3d3d66b827f18fbe903fe3df647013f09fc1e2191c035be1ee2d82a9e404686"
15
16do_compile_prepend() {
17 mkdir -p ${S}/libltdl
18 cp ${STAGING_LIBDIR}/libltdl* ${S}/libltdl
19}