From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 87FD5158091 for ; Sat, 18 Jun 2022 00:18:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 90DE5E0B09; Sat, 18 Jun 2022 00:18:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 71818E0B09 for ; Sat, 18 Jun 2022 00:18:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 43770341E39 for ; Sat, 18 Jun 2022 00:18:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9892250A for ; Sat, 18 Jun 2022 00:18:26 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1655511496.3408c976d850bad9d19c1cdc25fbf0851cb9b22d.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/pulseaudio-daemon/files/, media-sound/pulseaudio-daemon/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-sound/pulseaudio-daemon/files/pulseaudio-16.0-fix-combine-sink-underrun-crash.patch media-sound/pulseaudio-daemon/pulseaudio-daemon-16.0-r5.ebuild X-VCS-Directories: media-sound/pulseaudio-daemon/ media-sound/pulseaudio-daemon/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3408c976d850bad9d19c1cdc25fbf0851cb9b22d X-VCS-Branch: master Date: Sat, 18 Jun 2022 00:18:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 2ea1f3f5-1968-4d2f-abbe-26c868933411 X-Archives-Hash: 4785804d1b298e3bb9bc5e4f6287f2eb commit: 3408c976d850bad9d19c1cdc25fbf0851cb9b22d Author: Igor V. Kovalenko gmail com> AuthorDate: Fri Jun 17 23:37:29 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jun 18 00:18:16 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3408c976 media-sound/pulseaudio-daemon: Fix crash after combine-sink underrun Upstream commit ee8bfb49adddd271d8a8cafa796c6f9fa84de48a Closes: https://bugs.gentoo.org/852848 Signed-off-by: Igor V. Kovalenko gmail.com> Signed-off-by: Sam James gentoo.org> ...udio-16.0-fix-combine-sink-underrun-crash.patch | 72 ++++++++++++++++++++++ .../pulseaudio-daemon-16.0-r5.ebuild | 1 + 2 files changed, 73 insertions(+) diff --git a/media-sound/pulseaudio-daemon/files/pulseaudio-16.0-fix-combine-sink-underrun-crash.patch b/media-sound/pulseaudio-daemon/files/pulseaudio-16.0-fix-combine-sink-underrun-crash.patch new file mode 100644 index 000000000000..d66d75afdfda --- /dev/null +++ b/media-sound/pulseaudio-daemon/files/pulseaudio-16.0-fix-combine-sink-underrun-crash.patch @@ -0,0 +1,72 @@ +https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/ee8bfb49adddd271d8a8cafa796c6f9fa84de48a + +From ee8bfb49adddd271d8a8cafa796c6f9fa84de48a Mon Sep 17 00:00:00 2001 +From: Georg Chini +Date: Fri, 17 Jun 2022 13:11:11 +0200 +Subject: [PATCH] combine-sink: Fix threading issue during underrun + +A recent commit added i->origin sink for the sink inputs of the combine sinks. +Therefore pa_sink_process_input_underruns() treated the combine sink like +filter sinks. pa_sink_process_input_underruns() calls itself with the +origin sink, which is only correct for filter sinks because they run in the +thread context of the origin sink. The combine sink however has its own +thread context, so pa_sink_process_input_underruns() was executed in the +wrong context. +This patch fixes the issue by skipping the section for module-combine-sink. + +Part-of: +--- + src/pulsecore/sink.c | 37 +++++++++++++++++++++++-------------- + 1 file changed, 23 insertions(+), 14 deletions(-) + +diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c +index 3108ae765..0f0dc56fc 100644 +--- a/src/pulsecore/sink.c ++++ b/src/pulsecore/sink.c +@@ -1016,20 +1016,29 @@ size_t pa_sink_process_input_underruns(pa_sink *s, size_t left_to_play) { + if (i->origin_sink) { + size_t filter_result, left_to_play_origin; + +- /* The recursive call works in the origin sink domain ... */ +- left_to_play_origin = pa_convert_size(left_to_play, &i->sink->sample_spec, &i->origin_sink->sample_spec); +- +- /* .. and returns the time to sleep before waking up. We need the +- * underrun duration for comparisons, so we undo the subtraction on +- * the return value... */ +- filter_result = left_to_play_origin - pa_sink_process_input_underruns(i->origin_sink, left_to_play_origin); +- +- /* ... and convert it back to the master sink domain */ +- filter_result = pa_convert_size(filter_result, &i->origin_sink->sample_spec, &i->sink->sample_spec); +- +- /* Remember the longest underrun so far */ +- if (filter_result > result) +- result = filter_result; ++ /* The combine sink sets i->origin sink but has a different threading model ++ * than the filter sinks. Therefore the recursion below may not be executed ++ * because pa_sink_process_input_underruns() was not called in the thread ++ * context of the origin sink. ++ * FIXME: It is unclear if some other kind of recursion would be necessary ++ * for the combine sink. */ ++ if (!i->module || !pa_safe_streq(i->module->name, "module-combine-sink")) { ++ ++ /* The recursive call works in the origin sink domain ... */ ++ left_to_play_origin = pa_convert_size(left_to_play, &i->sink->sample_spec, &i->origin_sink->sample_spec); ++ ++ /* .. and returns the time to sleep before waking up. We need the ++ * underrun duration for comparisons, so we undo the subtraction on ++ * the return value... */ ++ filter_result = left_to_play_origin - pa_sink_process_input_underruns(i->origin_sink, left_to_play_origin); ++ ++ /* ... and convert it back to the master sink domain */ ++ filter_result = pa_convert_size(filter_result, &i->origin_sink->sample_spec, &i->sink->sample_spec); ++ ++ /* Remember the longest underrun so far */ ++ if (filter_result > result) ++ result = filter_result; ++ } + } + + if (uf == 0) { +-- +GitLab + diff --git a/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.0-r5.ebuild b/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.0-r5.ebuild index cf0871a10c25..c6b1b5a0b623 100644 --- a/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.0-r5.ebuild +++ b/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.0-r5.ebuild @@ -165,6 +165,7 @@ S="${WORKDIR}/${MY_P}" PATCHES=( "${FILESDIR}"/pulseaudio-16.0-fix-rtp-receiver-sdp-record.patch "${FILESDIR}"/pulseaudio-16.0-optional-module-console-kit.patch + "${FILESDIR}"/pulseaudio-16.0-fix-combine-sink-underrun-crash.patch ) src_prepare() {