[pulseaudio-commits] 7 commits - NEWS src/modules src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Mon Sep 18 15:58:31 UTC 2017
NEWS | 18 ++++++++++++++++
src/modules/alsa/alsa-mixer.c | 2 -
src/modules/alsa/mixer/profile-sets/default.conf | 15 ++++++++-----
src/modules/bluetooth/backend-native.c | 1
src/modules/bluetooth/module-bluez5-device.c | 12 ++++++++++-
src/modules/bluetooth/module-bluez5-discover.c | 2 -
src/pulsecore/sink.c | 25 +++++++++++++----------
src/pulsecore/source.c | 23 +++++++++++++--------
8 files changed, 71 insertions(+), 27 deletions(-)
New commits:
commit 2693e3fe55f1c10ad4eb1c82c66b103cb5b4888a
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Mon Sep 18 17:40:00 2017 +0300
update NEWS
diff --git a/NEWS b/NEWS
index cc179038..3a7c88ff 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+PulseAudio 11.1
+
+A bug fix release.
+
+ * Fix a crash in filter modules related to flat volumes and volume sharing
+ * Fix a crash when the bluetooth adapter reports weird MTU size
+ * Disable bluetooth MTU autodetection by default
+ * Add mixer handling back for hardware that doesn't have any alsa-lib
+ configuration
+ * Prioritize USB devices over built-in sound cards (11.0 was supposed to have
+ this feature, but the implementation turned out to be incomplete)
+
+Contributors
+
+ Arun Raghavan
+ Tanu Kaskinen
+
+
PulseAudio 11.0
Changes at a glance:
commit b6bba65d6278335746c87e930ad18c5ec3618924
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Wed Sep 13 12:49:28 2017 +0530
bluez: Don't crash on strange MTU sizes
We got reports of this with automatically detected MTUs that weren't
frame aligned.
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index 7a79f21f..8a906393 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -797,6 +797,16 @@ static void transport_config_mtu(struct userdata *u) {
if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT || u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY) {
u->read_block_size = u->read_link_mtu;
u->write_block_size = u->write_link_mtu;
+
+ if (!pa_frame_aligned(u->read_block_size, &u->source->sample_spec)) {
+ pa_log_debug("Got invalid read MTU: %lu, rounding down", u->read_block_size);
+ u->read_block_size = pa_frame_align(u->read_block_size, &u->source->sample_spec);
+ }
+
+ if (!pa_frame_aligned(u->write_block_size, &u->sink->sample_spec)) {
+ pa_log_debug("Got invalid write MTU: %lu, rounding down", u->write_block_size);
+ u->write_block_size = pa_frame_align(u->write_block_size, &u->sink->sample_spec);
+ }
} else {
u->read_block_size =
(u->read_link_mtu - sizeof(struct rtp_header) - sizeof(struct rtp_payload))
commit 82e7fe413e86e9e3098d9676649e1c66e5996899
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Wed Sep 13 09:22:27 2017 +0530
bluez: Don't autodetect MTU by default
This breaks a lot of headsets, so disabling by default. Can be
re-enabled in configuration for specific hardware where it is deemed
necessary.
Also added some debug logging to be able to examine what MTU size is
reported by the device.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102660
diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c
index 1ed436f2..5ba74396 100644
--- a/src/modules/bluetooth/backend-native.c
+++ b/src/modules/bluetooth/backend-native.c
@@ -206,6 +206,7 @@ static int sco_acquire_cb(pa_bluetooth_transport *t, bool optional, size_t *imtu
if (getsockopt(sock, SOL_SCO, SCO_OPTIONS, &sco_opt, &len) < 0)
pa_log_warn("getsockopt(SCO_OPTIONS) failed, loading defaults");
else {
+ pa_log_debug("autodetected imtu = omtu = %u", sco_opt.mtu);
if (imtu) *imtu = sco_opt.mtu;
if (omtu) *omtu = sco_opt.mtu;
}
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index ebe7c774..7a79f21f 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -2276,7 +2276,7 @@ int pa__init(pa_module* m) {
goto fail_free_modargs;
}
- autodetect_mtu = true;
+ autodetect_mtu = false;
if (pa_modargs_get_value_boolean(ma, "autodetect_mtu", &autodetect_mtu) < 0) {
pa_log("Invalid boolean value for autodetect_mtu parameter");
goto fail_free_modargs;
diff --git a/src/modules/bluetooth/module-bluez5-discover.c b/src/modules/bluetooth/module-bluez5-discover.c
index 6dbf24ea..495da762 100644
--- a/src/modules/bluetooth/module-bluez5-discover.c
+++ b/src/modules/bluetooth/module-bluez5-discover.c
@@ -124,7 +124,7 @@ int pa__init(pa_module *m) {
goto fail;
}
- autodetect_mtu = true;
+ autodetect_mtu = false;
if (pa_modargs_get_value_boolean(ma, "autodetect_mtu", &autodetect_mtu) < 0) {
pa_log("Invalid boolean value for autodetect_mtu parameter");
goto fail;
commit 56b6e3253500051828c1fc43f16054aa4211ad5f
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Fri Sep 8 15:10:41 2017 +0300
alsa-mixer: add mixer handling to the fallback stereo case
Some sound cards don't have any alsa-lib configuration, but they used to
work well enough up to PulseAudio 10. PulseAudio 11 stopped using "hw:0"
for the analog-stereo mapping, and instead defined it as a fallback
mapping without any mixer handling. As a result, switching between
headphones and speakers stopped working without changing the mixer
settings manually at least on Toshiba Chromebook 2. This patch adds the
mixer handling back to the fallback mapping.
I also renamed "unknown-stereo" to "stereo-fallback", because I like
that name more.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102560
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 08ea45d3..7de1c7de 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -3990,6 +3990,7 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
static const struct description_map well_known_descriptions[] = {
{ "analog-mono", N_("Analog Mono") },
{ "analog-stereo", N_("Analog Stereo") },
+ { "stereo-fallback", N_("Stereo") },
/* Note: Not translated to "Analog Stereo Input", because the source
* name gets "Input" appended to it automatically, so adding "Input"
* here would lead to the source name to become "Analog Stereo Input
@@ -4017,7 +4018,6 @@ static int mapping_verify(pa_alsa_mapping *m, const pa_channel_map *bonus) {
{ "iec958-dts-surround-51", N_("Digital Surround 5.1 (IEC958/DTS)") },
{ "hdmi-stereo", N_("Digital Stereo (HDMI)") },
{ "hdmi-surround-51", N_("Digital Surround 5.1 (HDMI)") },
- { "unknown-stereo", N_("Stereo") },
};
pa_assert(m);
diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
index f412058f..c360e772 100644
--- a/src/modules/alsa/mixer/profile-sets/default.conf
+++ b/src/modules/alsa/mixer/profile-sets/default.conf
@@ -115,6 +115,15 @@ paths-output = analog-output analog-output-lineout analog-output-speaker analog-
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
priority = 10
+# If everything else fails, try to use hw:0 as a stereo device.
+[Mapping stereo-fallback]
+device-strings = hw:%f
+fallback = yes
+channel-map = front-left,front-right
+paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
+paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
+priority = 1
+
[Mapping analog-surround-21]
device-strings = surround21:%f
channel-map = front-left,front-right,lfe
@@ -460,12 +469,6 @@ priority = 1
direction = input
paths-input = multichannel-input
-[Mapping unknown-stereo]
-device-strings = hw:%f
-channel-map = front-left,front-right
-fallback = yes
-priority = 1
-
; An example for defining multiple-sink profiles
#[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]
#description = Foobar
commit bd151646ddeb03c02d7e677a91eb09614acde8e1
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Wed Sep 6 16:08:29 2017 +0300
sink: remove priority bonus for the "internal" form factor
We're supposed to prioritize USB sound cards over PCI sound cards, but
the priority bonus for the "internal" form factor prevents this from
happening. Not all (if any) USB sound cards have the form factor
property set, whereas at least on my laptop the on-board sound card has
the form factor set to "internal".
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index d1c7fd3b..94f41b92 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -3558,8 +3558,6 @@ unsigned pa_device_init_priority(pa_proplist *p) {
priority += 500;
else if (pa_streq(s, "portable"))
priority += 450;
- else if (pa_streq(s, "internal"))
- priority += 400;
}
if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_BUS))) {
commit f63c13f62f6402020ee558df459110470137554d
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Sun Sep 10 22:32:57 2017 +0300
sink, source: fix out of date comments
update_shared_real_volume() doesn't exist. I checked that
update_real_volume() does what the comments claim
update_shared_real_volume() to do.
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index e96c05fe..d1c7fd3b 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1980,7 +1980,7 @@ static void propagate_reference_volume(pa_sink *s) {
/* Since the origin sink uses volume sharing, this input's volume
* needs to be updated to match the root sink's real volume, but
- * that will be done later in update_shared_real_volume(). */
+ * that will be done later in update_real_volume(). */
continue;
}
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index b9db4c62..e0d32af4 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1530,7 +1530,7 @@ static void propagate_reference_volume(pa_source *s) {
/* Since the origin source uses volume sharing, this output's volume
* needs to be updated to match the root source's real volume, but
- * that will be done later in update_shared_real_volume(). */
+ * that will be done later in update_real_volume(). */
continue;
}
commit 95d618751c0a7cb4d739d339d97499d0c98fb955
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Sun Sep 10 22:32:56 2017 +0300
sink, source: don't try to update volumes of not-yet-linked devices
The order of the pa_sink_input_put() and pa_sink_put() calls in filter
modules was swapped in commit edc465da77 ("virtual sources and sinks:
Don't double attach a sink input or source output on filter load").
If flat volumes and volume sharing is enabled, the pa_sink_input_put()
call will update volumes of the whole tree of virtual sinks that are
connected to the root sink. The recursive updating procedure tried to
also update the volume of the new sink for which pa_sink_put() had not
yet been called, causing an assertion failure.
This patch tries to make sure that the volume of not-yet-linked sinks
is never changed. pa_sink_put() will set the sink volume correctly, so
it's fine to skip the not-yet-linked sinks during pa_sink_input_put().
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102549
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 0cc76514..e96c05fe 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1734,7 +1734,8 @@ static void compute_reference_ratios(pa_sink *s) {
PA_IDXSET_FOREACH(i, s->inputs, idx) {
compute_reference_ratio(i);
- if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER))
+ if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)
+ && PA_SINK_IS_LINKED(i->origin_sink->state))
compute_reference_ratios(i->origin_sink);
}
}
@@ -1761,7 +1762,8 @@ static void compute_real_ratios(pa_sink *s) {
pa_cvolume_reset(&i->real_ratio, i->real_ratio.channels);
i->soft_volume = i->volume_factor;
- compute_real_ratios(i->origin_sink);
+ if (PA_SINK_IS_LINKED(i->origin_sink->state))
+ compute_real_ratios(i->origin_sink);
continue;
}
@@ -1860,7 +1862,8 @@ static void get_maximum_input_volume(pa_sink *s, pa_cvolume *max_volume, const p
pa_cvolume remapped;
if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) {
- get_maximum_input_volume(i->origin_sink, max_volume, channel_map);
+ if (PA_SINK_IS_LINKED(i->origin_sink->state))
+ get_maximum_input_volume(i->origin_sink, max_volume, channel_map);
/* Ignore this input. The origin sink uses volume sharing, so this
* input's volume will be set to be equal to the root sink's real
@@ -1916,7 +1919,8 @@ static void update_real_volume(pa_sink *s, const pa_cvolume *new_volume, pa_chan
compute_reference_ratio(i);
}
- update_real_volume(i->origin_sink, new_volume, channel_map);
+ if (PA_SINK_IS_LINKED(i->origin_sink->state))
+ update_real_volume(i->origin_sink, new_volume, channel_map);
}
}
}
@@ -1971,7 +1975,8 @@ static void propagate_reference_volume(pa_sink *s) {
pa_cvolume new_volume;
if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) {
- propagate_reference_volume(i->origin_sink);
+ if (PA_SINK_IS_LINKED(i->origin_sink->state))
+ propagate_reference_volume(i->origin_sink);
/* Since the origin sink uses volume sharing, this input's volume
* needs to be updated to match the root sink's real volume, but
@@ -2029,7 +2034,8 @@ static bool update_reference_volume(pa_sink *s, const pa_cvolume *v, const pa_ch
return false;
PA_IDXSET_FOREACH(i, s->inputs, idx) {
- if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER))
+ if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)
+ && PA_SINK_IS_LINKED(i->origin_sink->state))
update_reference_volume(i->origin_sink, v, channel_map, false);
}
@@ -2200,7 +2206,8 @@ static void propagate_real_volume(pa_sink *s, const pa_cvolume *old_real_volume)
pa_sw_cvolume_multiply(&new_volume, &new_volume, &i->reference_ratio);
pa_sink_input_set_volume_direct(i, &new_volume);
- if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER))
+ if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)
+ && PA_SINK_IS_LINKED(i->origin_sink->state))
propagate_real_volume(i->origin_sink, old_real_volume);
}
}
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index b2936c5f..b9db4c62 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -1284,7 +1284,8 @@ static void compute_reference_ratios(pa_source *s) {
PA_IDXSET_FOREACH(o, s->outputs, idx) {
compute_reference_ratio(o);
- if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER))
+ if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)
+ && PA_SOURCE_IS_LINKED(o->destination_source->state))
compute_reference_ratios(o->destination_source);
}
}
@@ -1311,7 +1312,8 @@ static void compute_real_ratios(pa_source *s) {
pa_cvolume_reset(&o->real_ratio, o->real_ratio.channels);
o->soft_volume = o->volume_factor;
- compute_real_ratios(o->destination_source);
+ if (PA_SOURCE_IS_LINKED(o->destination_source->state))
+ compute_real_ratios(o->destination_source);
continue;
}
@@ -1410,7 +1412,8 @@ static void get_maximum_output_volume(pa_source *s, pa_cvolume *max_volume, cons
pa_cvolume remapped;
if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) {
- get_maximum_output_volume(o->destination_source, max_volume, channel_map);
+ if (PA_SOURCE_IS_LINKED(o->destination_source->state))
+ get_maximum_output_volume(o->destination_source, max_volume, channel_map);
/* Ignore this output. The origin source uses volume sharing, so this
* output's volume will be set to be equal to the root source's real
@@ -1466,7 +1469,8 @@ static void update_real_volume(pa_source *s, const pa_cvolume *new_volume, pa_ch
compute_reference_ratio(o);
}
- update_real_volume(o->destination_source, new_volume, channel_map);
+ if (PA_SOURCE_IS_LINKED(o->destination_source->state))
+ update_real_volume(o->destination_source, new_volume, channel_map);
}
}
}
@@ -1521,7 +1525,8 @@ static void propagate_reference_volume(pa_source *s) {
pa_cvolume new_volume;
if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) {
- propagate_reference_volume(o->destination_source);
+ if (PA_SOURCE_IS_LINKED(o->destination_source->state))
+ propagate_reference_volume(o->destination_source);
/* Since the origin source uses volume sharing, this output's volume
* needs to be updated to match the root source's real volume, but
@@ -1579,7 +1584,8 @@ static bool update_reference_volume(pa_source *s, const pa_cvolume *v, const pa_
return false;
PA_IDXSET_FOREACH(o, s->outputs, idx) {
- if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER))
+ if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)
+ && PA_SOURCE_IS_LINKED(o->destination_source->state))
update_reference_volume(o->destination_source, v, channel_map, false);
}
@@ -1759,7 +1765,8 @@ static void propagate_real_volume(pa_source *s, const pa_cvolume *old_real_volum
pa_sw_cvolume_multiply(&new_volume, &new_volume, &o->reference_ratio);
pa_source_output_set_volume_direct(o, &new_volume);
- if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER))
+ if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)
+ && PA_SOURCE_IS_LINKED(o->destination_source->state))
propagate_real_volume(o->destination_source, old_real_volume);
}
}
More information about the pulseaudio-commits
mailing list