mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -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>
This commit is contained in:
parent
0647fcb622
commit
566849c4af
1 changed files with 2 additions and 1 deletions
|
|
@ -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 */
|
/* If we are initializing, add the time since resume to the card time at pause_time */
|
||||||
else if (s->init) {
|
else if (s->init) {
|
||||||
current_time += (s->pause_time - s->start_time - s->time_offset - s->fixup_time) * s->time_factor;
|
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 */
|
/* Smoother is running, calculate current sound card time */
|
||||||
} else
|
} else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue