commit: cf0e9903a054aff5c703d3c0e465a8e7610c3ca0 Author: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com> AuthorDate: Fri Oct 6 08:35:12 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Oct 6 12:05:10 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf0e9903
media-libs/libpulse: Backport smoother fixes to 16.1 Upstream commits: 8fe50bbc31e11abf2f30864f1e2dbdaa16d0e1c3 c3eae5d00cb79bd897049483126e75bb48a69cd1 Closes: https://bugs.gentoo.org/914882 Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com> Signed-off-by: Sam James <sam <AT> gentoo.org> .../pulseaudio-16.1-smoother-start-paused.patch | 26 +++++++++++++++++++++ ...pulseaudio-16.1-smoother-time-calculation.patch | 27 ++++++++++++++++++++++ media-libs/libpulse/libpulse-16.1-r3.ebuild | 2 ++ 3 files changed, 55 insertions(+) diff --git a/media-libs/libpulse/files/pulseaudio-16.1-smoother-start-paused.patch b/media-libs/libpulse/files/pulseaudio-16.1-smoother-start-paused.patch new file mode 100644 index 000000000000..3f0acbc8f95e --- /dev/null +++ b/media-libs/libpulse/files/pulseaudio-16.1-smoother-start-paused.patch @@ -0,0 +1,26 @@ +commit 8fe50bbc31e11abf2f30864f1e2dbdaa16d0e1c3 +Author: Georg Chini <[email protected]> +Date: Thu Aug 25 08:11:04 2022 +0200 + + time-smoother-2: Fix stream time when stream starts paused + + When a stream is started but has not yet called smoother_2_put(), pa_smoother_2_get() + returns the time since the start of the stream even if the stream was started paused. + When the stream is started paused, pa_smoother_2_get() should return 0 instead. This + patch fixes the problem. + + Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/745> + +diff --git a/src/pulsecore/time-smoother_2.c b/src/pulsecore/time-smoother_2.c +index e14b52f72..ea7ec1b36 100644 +--- a/src/pulsecore/time-smoother_2.c ++++ b/src/pulsecore/time-smoother_2.c +@@ -295,7 +295,7 @@ pa_usec_t pa_smoother_2_get(pa_smoother_2 *s, pa_usec_t time_stamp) { + + /* If the smoother has not started, just return system time since resume */ + if (!s->start_time) { +- if (time_stamp >= s->resume_time) ++ if (time_stamp >= s->resume_time && !s->paused) + current_time = time_stamp - s->resume_time; + else + current_time = 0; diff --git a/media-libs/libpulse/files/pulseaudio-16.1-smoother-time-calculation.patch b/media-libs/libpulse/files/pulseaudio-16.1-smoother-time-calculation.patch new file mode 100644 index 000000000000..9d976e5be984 --- /dev/null +++ b/media-libs/libpulse/files/pulseaudio-16.1-smoother-time-calculation.patch @@ -0,0 +1,27 @@ +commit c3eae5d00cb79bd897049483126e75bb48a69cd1 +Author: flyingOwl <[email protected]> +Date: Fri Dec 30 00:16:03 2022 +0100 + + time-smoother-2: Fix time calculation by comparing timestamps + + This fixes the rare case of resume_time being bigger than time_stamp. Which + happens sometimes when a gstreamer client is quickly seeking through a + media file. The resulting integer underflow then causes a huge value in + current_time which will break the playback. + + Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/764> + +diff --git a/src/pulsecore/time-smoother_2.c b/src/pulsecore/time-smoother_2.c +index ea7ec1b36..46cc5e9cc 100644 +--- a/src/pulsecore/time-smoother_2.c ++++ b/src/pulsecore/time-smoother_2.c +@@ -307,7 +307,8 @@ pa_usec_t pa_smoother_2_get(pa_smoother_2 *s, pa_usec_t time_stamp) { + /* If we are initializing, add the time since resume to the card time at pause_time */ + else if (s->init) { + current_time += (s->pause_time - s->start_time - s->time_offset - s->fixup_time) * s->time_factor; +- current_time += (time_stamp - s->resume_time) * s->time_factor; ++ if (time_stamp > s->resume_time) ++ current_time += (time_stamp - s->resume_time) * s->time_factor; + + /* Smoother is running, calculate current sound card time */ + } else diff --git a/media-libs/libpulse/libpulse-16.1-r3.ebuild b/media-libs/libpulse/libpulse-16.1-r3.ebuild index a924d41221ce..4668093c1a09 100644 --- a/media-libs/libpulse/libpulse-16.1-r3.ebuild +++ b/media-libs/libpulse/libpulse-16.1-r3.ebuild @@ -77,6 +77,8 @@ DOCS=( NEWS README ) PATCHES=( "${FILESDIR}"/pulseaudio-16.1-memfd-cleanup.patch "${FILESDIR}"/pulseaudio-16.1-proplist-util-without-gdkx.patch + "${FILESDIR}"/pulseaudio-16.1-smoother-start-paused.patch + "${FILESDIR}"/pulseaudio-16.1-smoother-time-calculation.patch ) src_prepare() {
