mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-01 22:58:47 -04:00
Correctly deal with events in the past in calc_next_timeout
pa_usec_t is unsigned, thus it will always be >= 0 This makes gstreamer pulse mixer work again This fixes a gstreamer mixer regression, when it can't control the volume, after few changes.
This commit is contained in:
parent
9bd3398f94
commit
23a294c97e
1 changed files with 6 additions and 7 deletions
|
|
@ -765,23 +765,22 @@ static pa_time_event* find_next_time_event(pa_mainloop *m) {
|
|||
|
||||
static int calc_next_timeout(pa_mainloop *m) {
|
||||
pa_time_event *t;
|
||||
pa_usec_t usec;
|
||||
pa_usec_t clock_now;
|
||||
|
||||
if (!m->n_enabled_time_events)
|
||||
return -1;
|
||||
|
||||
t = find_next_time_event(m);
|
||||
pa_assert(t);
|
||||
pa_assert_se(t = find_next_time_event(m));
|
||||
|
||||
if (t->time == 0)
|
||||
if (t->time <= 0)
|
||||
return 0;
|
||||
|
||||
usec = t->time - pa_rtclock_now();
|
||||
clock_now = pa_rtclock_now();
|
||||
|
||||
if (usec <= 0)
|
||||
if (t->time <= clock_now)
|
||||
return 0;
|
||||
|
||||
return (int) (usec / 1000); /* in milliseconds */
|
||||
return (int) ((t->time - clock_now) / 1000); /* in milliseconds */
|
||||
}
|
||||
|
||||
static int dispatch_timeout(pa_mainloop *m) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue