diff -Nru pulseaudio-8.0/debian/changelog pulseaudio-8.0/debian/changelog --- pulseaudio-8.0/debian/changelog 2017-06-07 21:16:31.000000000 +0800 +++ pulseaudio-8.0/debian/changelog 2017-08-11 15:19:49.000000000 +0800 @@ -1,3 +1,13 @@ +pulseaudio (1:8.0-0ubuntu3.4) UNRELEASED; urgency=medium + + * debian/control: Update Vcs fields to launchpad git. + * Cherrypick fixes for common crashes from upstream: + - cb78d6f5: SIGABRT in device_start_waiting_for_profiles (LP: #1690028, + LP: #1672171) + - d985276c: SIGABRT in pa_alsa_path_set_volume (LP: #1539209, LP: #1562817) + + -- Daniel van Vugt Fri, 11 Aug 2017 15:16:57 +0800 + pulseaudio (1:8.0-0ubuntu3.3) xenial; urgency=medium [Luke Yelavich, Konrad ZapaƂowicz] diff -Nru pulseaudio-8.0/debian/control pulseaudio-8.0/debian/control --- pulseaudio-8.0/debian/control 2016-12-08 10:47:46.000000000 +0800 +++ pulseaudio-8.0/debian/control 2017-08-11 15:16:30.000000000 +0800 @@ -51,8 +51,8 @@ libxcb1-dev (>= 1.6), libxtst-dev Standards-Version: 3.9.6 -Vcs-Git: git://anonscm.debian.org/pkg-pulseaudio/pulseaudio.git -Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-pulseaudio/pulseaudio.git +Vcs-Git: https://git.launchpad.net/~ubuntu-audio-dev/pulseaudio?h=ubuntu-xenial +Vcs-Browser: https://git.launchpad.net/~ubuntu-audio-dev/pulseaudio?h=ubuntu-xenial Homepage: http://www.pulseaudio.org XS-Testsuite: autopkgtest diff -Nru pulseaudio-8.0/debian/patches/0800-cb78d6f5-fix-lp1690028-lp1672171.patch pulseaudio-8.0/debian/patches/0800-cb78d6f5-fix-lp1690028-lp1672171.patch --- pulseaudio-8.0/debian/patches/0800-cb78d6f5-fix-lp1690028-lp1672171.patch 1970-01-01 08:00:00.000000000 +0800 +++ pulseaudio-8.0/debian/patches/0800-cb78d6f5-fix-lp1690028-lp1672171.patch 2017-08-11 15:40:30.000000000 +0800 @@ -0,0 +1,122 @@ +From cb78d6f57c00f3694dae9110f7a7d6f80e3344ac Mon Sep 17 00:00:00 2001 +From: Tanu Kaskinen +Date: Thu, 16 Mar 2017 23:48:43 +0200 +Subject: [PATCH] bluez5-util: fix profile waiting logic + +There were two bugs in the old logic. The first one: + +If a device has two profiles, the old code would start the wait timer +when the first profile connects, but when the second profile connects, +the timer would not get stopped and the CONNECTION_CHANGED hook would +not get fired, because the code for that was inside an if block that +only gets executed when the first profile connects. As a result, +module-bluez5-device loading would always be delayed until the wait +timeout expires. + +The second bug: + +A crash was observed in device_start_waiting_for_profiles(). That +function is called whenever the connected profile count changes from 0 +to 1. The function also has an assertion that checks that the timer is +not running when the function is called. That assertion crashed in the +following scenario with a headset that supports HSP and A2DP: + +1. First HSP gets connected. The timer is started. + +2. Then HSP gets disconnected for some reason. The timer is still +running. + +3. Then A2DP gets connected. device_start_waiting_for_profiles() is +called, because the connected profile count changed from 0 to 1 again. +The timer is already running, so the assertion fails. + +First I thought I'd remove the assertion from +device_start_waiting_for_profiles() and just restart the timer on the +second call, but then I figured that when the device returns to the +"everything disconnected" state in step 2, it would be better to stop +the timer. The purpose of the timer is to delay the notification of the +device becoming connected, but if the device becomes disconnected during +the waiting period, the notification doesn't make sense any more, and +therefore the timer doesn't make sense either. + +BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100237 +--- + src/modules/bluetooth/bluez5-util.c | 49 ++++++++++++++++++++++++++----------- + 1 file changed, 35 insertions(+), 14 deletions(-) + +diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c +index 107255184..8e50e0be7 100644 +--- a/src/modules/bluetooth/bluez5-util.c ++++ b/src/modules/bluetooth/bluez5-util.c +@@ -259,6 +259,9 @@ static void device_start_waiting_for_profiles(pa_bluetooth_device *device) { + + void pa_bluetooth_transport_set_state(pa_bluetooth_transport *t, pa_bluetooth_transport_state_t state) { + bool old_any_connected; ++ unsigned n_disconnected_profiles; ++ bool new_device_appeared; ++ bool device_disconnected; + + pa_assert(t); + +@@ -274,26 +277,44 @@ void pa_bluetooth_transport_set_state(pa_bluetooth_transport *t, pa_bluetooth_tr + + pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t); + +- if (old_any_connected != pa_bluetooth_device_any_transport_connected(t->device)) { +- unsigned n_disconnected_profiles; ++ /* If there are profiles that are expected to get connected soon (based ++ * on the UUID list), we wait for a bit before announcing the new ++ * device, so that all profiles have time to get connected before the ++ * card object is created. If we didn't wait, the card would always ++ * have only one profile marked as available in the initial state, ++ * which would prevent module-card-restore from restoring the initial ++ * profile properly. */ + +- /* If there are profiles that are expected to get conneced soon (based +- * on the UUID list), we wait for a bit before announcing the new +- * device, so that all profiles have time to get connected before the +- * card object is created. If we didn't wait, the card would always +- * have only one profile marked as available in the initial state, +- * which would prevent module-card-restore from restoring initial +- * profile properly. */ ++ n_disconnected_profiles = device_count_disconnected_profiles(t->device); + +- n_disconnected_profiles = device_count_disconnected_profiles(t->device); ++ new_device_appeared = !old_any_connected && pa_bluetooth_device_any_transport_connected(t->device); ++ device_disconnected = old_any_connected && !pa_bluetooth_device_any_transport_connected(t->device); + +- if (n_disconnected_profiles == 0) +- device_stop_waiting_for_profiles(t->device); +- +- if (!old_any_connected && n_disconnected_profiles > 0) ++ if (new_device_appeared) { ++ if (n_disconnected_profiles > 0) + device_start_waiting_for_profiles(t->device); + else + pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED], t->device); ++ return; ++ } ++ ++ if (device_disconnected) { ++ if (t->device->wait_for_profiles_timer) { ++ /* If the timer is still running when the device disconnects, we ++ * never sent the notification of the device getting connected, so ++ * we don't need to send a notification about the disconnection ++ * either. Let's just stop the timer. */ ++ device_stop_waiting_for_profiles(t->device); ++ } else ++ pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED], t->device); ++ return; ++ } ++ ++ if (n_disconnected_profiles == 0 && t->device->wait_for_profiles_timer) { ++ /* All profiles are now connected, so we can stop the wait timer and ++ * send a notification of the new device. */ ++ device_stop_waiting_for_profiles(t->device); ++ pa_hook_fire(&t->device->discovery->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED], t->device); + } + } + +-- +2.11.0 + diff -Nru pulseaudio-8.0/debian/patches/0801-d985276c-fix-lp1539209-lp1562817.patch pulseaudio-8.0/debian/patches/0801-d985276c-fix-lp1539209-lp1562817.patch --- pulseaudio-8.0/debian/patches/0801-d985276c-fix-lp1539209-lp1562817.patch 1970-01-01 08:00:00.000000000 +0800 +++ pulseaudio-8.0/debian/patches/0801-d985276c-fix-lp1539209-lp1562817.patch 2017-08-11 15:40:55.000000000 +0800 @@ -0,0 +1,69 @@ +From d985276c8b4c005171ea10d412e854bb956a092b Mon Sep 17 00:00:00 2001 +From: Georg Chini +Date: Sat, 29 Apr 2017 10:07:01 +0200 +Subject: [PATCH] source/sink: Fix wrong calculation of + thread_info.current_hw_volume + +In pa_{source,sink}_new() and pa_{source,sink}_put() the current hardware +volume was miscalculated: + +hw volume (dB) = real volume (dB) + soft volume (dB) +was used instead of +hw volume (dB) = real volume (dB) - soft volume (dB) + +This lead to a crash in pa_alsa_path_set_volume() if high volumes were +set and the port was changed. + +This patch fixes the calculation. Thanks to Tanu for pointing out +the correct solution. + +Bug link: https://bugs.freedesktop.org/show_bug.cgi?id=65520 +--- + src/pulsecore/sink.c | 4 ++-- + src/pulsecore/source.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +Index: pulseaudio/src/pulsecore/sink.c +=================================================================== +--- pulseaudio.orig/src/pulsecore/sink.c ++++ pulseaudio/src/pulsecore/sink.c +@@ -342,7 +342,7 @@ pa_sink* pa_sink_new( + + PA_LLIST_HEAD_INIT(pa_sink_volume_change, s->thread_info.volume_changes); + s->thread_info.volume_changes_tail = NULL; +- pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); ++ pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); + s->thread_info.volume_change_safety_margin = core->deferred_volume_safety_margin_usec; + s->thread_info.volume_change_extra_delay = core->deferred_volume_extra_delay_usec; + s->thread_info.latency_offset = s->latency_offset; +@@ -639,7 +639,7 @@ void pa_sink_put(pa_sink* s) { + + s->thread_info.soft_volume = s->soft_volume; + s->thread_info.soft_muted = s->muted; +- pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); ++ pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); + + pa_assert((s->flags & PA_SINK_HW_VOLUME_CTRL) + || (s->base_volume == PA_VOLUME_NORM +Index: pulseaudio/src/pulsecore/source.c +=================================================================== +--- pulseaudio.orig/src/pulsecore/source.c ++++ pulseaudio/src/pulsecore/source.c +@@ -327,7 +327,7 @@ pa_source* pa_source_new( + + PA_LLIST_HEAD_INIT(pa_source_volume_change, s->thread_info.volume_changes); + s->thread_info.volume_changes_tail = NULL; +- pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); ++ pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); + s->thread_info.volume_change_safety_margin = core->deferred_volume_safety_margin_usec; + s->thread_info.volume_change_extra_delay = core->deferred_volume_extra_delay_usec; + s->thread_info.latency_offset = s->latency_offset; +@@ -590,7 +590,7 @@ void pa_source_put(pa_source *s) { + + s->thread_info.soft_volume = s->soft_volume; + s->thread_info.soft_muted = s->muted; +- pa_sw_cvolume_multiply(&s->thread_info.current_hw_volume, &s->soft_volume, &s->real_volume); ++ pa_sw_cvolume_divide(&s->thread_info.current_hw_volume, &s->real_volume, &s->soft_volume); + + pa_assert((s->flags & PA_SOURCE_HW_VOLUME_CTRL) + || (s->base_volume == PA_VOLUME_NORM diff -Nru pulseaudio-8.0/debian/patches/series pulseaudio-8.0/debian/patches/series --- pulseaudio-8.0/debian/patches/series 2017-06-07 21:16:31.000000000 +0800 +++ pulseaudio-8.0/debian/patches/series 2017-08-11 15:21:41.000000000 +0800 @@ -53,3 +53,7 @@ 0700-pulsecore-add-new-card-profile-hook.patch 0701-bluetooth-bluez5-wait-for-all-profiles-to-connect.patch + +# Fixes for common crashes, backported from PulseAudio 11.0 +0800-cb78d6f5-fix-lp1690028-lp1672171.patch +0801-d985276c-fix-lp1539209-lp1562817.patch