[Git][pulseaudio/pulseaudio][stable-16.x] time-smoother-2: Fix time calculation by comparing timestamps
Arun Raghavan (@arun)
gitlab at gitlab.freedesktop.org
Tue Sep 17 12:41:05 UTC 2024
Arun Raghavan pushed to branch stable-16.x at PulseAudio / pulseaudio
Commits:
566849c4 by flyingOwl at 2024-09-17T08:40:56-04:00
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>
- - - - -
1 changed file:
- src/pulsecore/time-smoother_2.c
Changes:
=====================================
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
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/566849c4aff8083bc838ac04c11ad91453771ee1
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/566849c4aff8083bc838ac04c11ad91453771ee1
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20240917/0dbb5e48/attachment.htm>
More information about the pulseaudio-commits
mailing list