diff -Nru pulseaudio-11.1/debian/changelog pulseaudio-11.1/debian/changelog --- pulseaudio-11.1/debian/changelog 2019-01-23 14:54:58.000000000 +0800 +++ pulseaudio-11.1/debian/changelog 2019-07-25 11:48:30.000000000 +0800 @@ -1,3 +1,26 @@ +pulseaudio (1:11.1-1ubuntu7.4) bionic; urgency=medium + + [Hui Wang] + * Add 0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch to fix + the stream restore problem (cbaeea4af766 stream-restore: Don't restore if + the active_port is PA_AVAILABLE_NO). (LP: #1834138) + + [Daniel van Vugt] + * Drop 0811-lp1663528-alsa-card-fix-null-dereference.patch because some + similar crashes are still getting through, so we can't declare the bug + fixed. + + -- Daniel van Vugt Thu, 25 Jul 2019 11:48:30 +0800 + +pulseaudio (1:11.1-1ubuntu7.3) bionic; urgency=medium + + * Add patches to resolve the most common pulseaudio crashes in 18.04: + - 0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch + - 0811-lp1663528-alsa-card-fix-null-dereference.patch + (LP: #1556439, LP: #1663528) + + -- Daniel van Vugt Tue, 09 Jul 2019 16:30:07 +0200 + pulseaudio (1:11.1-1ubuntu7.2) bionic; urgency=medium * Add steelseries headset support. This provides sufficient support to diff -Nru pulseaudio-11.1/debian/patches/0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch pulseaudio-11.1/debian/patches/0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch --- pulseaudio-11.1/debian/patches/0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch 1970-01-01 08:00:00.000000000 +0800 +++ pulseaudio-11.1/debian/patches/0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch 2019-07-22 16:22:31.000000000 +0800 @@ -0,0 +1,55 @@ +From 59d264ac56d644f626251daa44ef7b39a9a9fe03 Mon Sep 17 00:00:00 2001 +From: Georg Chini +Date: Sun, 3 Dec 2017 22:29:09 +0100 +Subject: [PATCH] sink, source: Don't finish move if unlink happens after + pa_*_move_all_start() + +When a sink input was unlinked between the calls to pa_sink_move_all_start() and +pa_sink_move_all_finish(), pa_sink_move_all_finish() tried to finish the move +of the already unlinked sink input, which lead to an assertion in +pa_sink_input_finish_move(). The same applies for the source side. + +This patch fixes the problem by checking the state of the sink input or +source output in pa_*_move_all_finish(). + +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103752 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1556439 +Forwarded: not-needed +Last-Update: 2019-07-01 + +Index: pulseaudio/src/pulsecore/sink.c +=================================================================== +--- pulseaudio.orig/src/pulsecore/sink.c ++++ pulseaudio/src/pulsecore/sink.c +@@ -920,9 +920,11 @@ void pa_sink_move_all_finish(pa_sink *s, + pa_assert(q); + + while ((i = PA_SINK_INPUT(pa_queue_pop(q)))) { +- if (pa_sink_input_finish_move(i, s, save) < 0) +- pa_sink_input_fail_move(i); ++ if (PA_SINK_INPUT_IS_LINKED(i->state)) { ++ if (pa_sink_input_finish_move(i, s, save) < 0) ++ pa_sink_input_fail_move(i); + ++ } + pa_sink_input_unref(i); + } + +Index: pulseaudio/src/pulsecore/source.c +=================================================================== +--- pulseaudio.orig/src/pulsecore/source.c ++++ pulseaudio/src/pulsecore/source.c +@@ -860,9 +860,11 @@ void pa_source_move_all_finish(pa_source + pa_assert(q); + + while ((o = PA_SOURCE_OUTPUT(pa_queue_pop(q)))) { +- if (pa_source_output_finish_move(o, s, save) < 0) +- pa_source_output_fail_move(o); ++ if (PA_SOURCE_OUTPUT_IS_LINKED(o->state)) { ++ if (pa_source_output_finish_move(o, s, save) < 0) ++ pa_source_output_fail_move(o); + ++ } + pa_source_output_unref(o); + } + diff -Nru pulseaudio-11.1/debian/patches/0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch pulseaudio-11.1/debian/patches/0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch --- pulseaudio-11.1/debian/patches/0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch 1970-01-01 08:00:00.000000000 +0800 +++ pulseaudio-11.1/debian/patches/0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch 2019-07-25 11:47:52.000000000 +0800 @@ -0,0 +1,86 @@ +From acc2833a352d11d30e025555ee4349dbdb7ff571 Mon Sep 17 00:00:00 2001 +From: Hui Wang +Date: Wed, 15 May 2019 14:39:27 +0800 +Subject: [PATCH] stream-restore: Don't restore if the active_port is + PA_AVAILABLE_NO + +We met two problems recently, one happened on a Lenovo machine with +dual analogue codecs, the other happened on a Dell machine with +a digital mic directly connected to PCH. The two problems are +basically same, there is an internal mic and an external mic, the +internal mic always shows up in the gnome-control-center, the external +mic only shows up when it is plugged. After the external mic is +plugged and users select it from gnome-control-center, the +gnome-control-center will read all saved streams through extension_cb, +and bind the source of external mic to all streams, after that the +apps only record sound via the source of external mic, after the +external mic is unplugged, the internal mic will automatically be +selected since it is the only left input device in the +gnome-control-center, since users don't select it, all streams are +still bond the source of external mic. When users record sound via +apps, they can't record any sound even the default_source is the +source of internal mic and the internal mic is selected in the UI. + +It is very common that a machine has internal mic and external mic, +but this problem didn't expose before, that is because both internal +mic and external mic belong to one source, but for those two +machines, the internal mic belongs to one source, while the external +mic belongs to another source (they are in differnt codecs or one is +in the codec and the other is from PCH), + +To fix it with a mininal change, we just check if the active_port is +PA_AVAILABLE_NO or not when building a new stream, if it is, don't +restore the device to the new built stream, let pa_source_output_new() +decide the source device for this stream. + +And we also do the same change to sink_input. + +This change only affects the new built streams, it will not change +the database, so the users' preference is still saved in the database, +after the active_port is not PA_AVAILABLE_NO, the new streams will +still restore to the preferred device. + +Signed-off-by: Hui Wang +(cherry picked from commit cbaeea4af7669003ae97064fe12fa75fd4870611) +Signed-off-by: Hui Wang + +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1834138 +Forwarded: yes +Last-Update: 2019-07-25 +--- + src/modules/module-stream-restore.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c +index eb758330c..fb60bb928 100644 +--- a/src/modules/module-stream-restore.c ++++ b/src/modules/module-stream-restore.c +@@ -1451,8 +1451,10 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n + same time, in which case we want to make sure we don't + interfere with that */ + if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s))) +- if (pa_sink_input_new_data_set_sink(new_data, s, true)) +- pa_log_info("Restoring device for stream %s.", name); ++ if (!s->active_port || s->active_port->available != PA_AVAILABLE_NO) { ++ if (pa_sink_input_new_data_set_sink(new_data, s, true)) ++ pa_log_info("Restoring device for stream %s.", name); ++ } + + entry_free(e); + } +@@ -1554,8 +1556,10 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou + same time, in which case we want to make sure we don't + interfere with that */ + if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) { +- pa_log_info("Restoring device for stream %s.", name); +- pa_source_output_new_data_set_source(new_data, s, true); ++ if (!s->active_port || s->active_port->available != PA_AVAILABLE_NO) { ++ pa_log_info("Restoring device for stream %s.", name); ++ pa_source_output_new_data_set_source(new_data, s, true); ++ } + } + + entry_free(e); +-- +2.17.1 + diff -Nru pulseaudio-11.1/debian/patches/series pulseaudio-11.1/debian/patches/series --- pulseaudio-11.1/debian/patches/series 2019-01-23 14:54:58.000000000 +0800 +++ pulseaudio-11.1/debian/patches/series 2019-07-24 19:47:50.000000000 +0800 @@ -23,6 +23,7 @@ memfd-glibc2.27.patch 0804-bluez5-device-Rewrite-of-thread-function-reduce-send.patch 0805-bluez5-device-Fix-memory-leak-in-sco_process_render.patch +0810-lp1556439-sink-source-Don-t-finish-move-if-unlink-happens-afte.patch # Bug fixes for Steelseries all backported from PulseAudio 12 steelseries.1.15386a710.patch @@ -30,3 +31,5 @@ steelseries.3.83675b374.patch steelseries.4.fe6a9a8f5.patch steelseries.5.3454c19f3.patch + +0900-stream-restore-Don-t-restore-if-the-active_port-is-P.patch