mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
Store previous reported time in order to assure a monotonic clock.
This is a resurrection of a feature previously removed. The new version is without the race condition of the original one. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@442 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
d429222476
commit
1015ea4241
2 changed files with 14 additions and 0 deletions
|
|
@ -65,6 +65,8 @@ struct pa_stream *pa_stream_new(struct pa_context *c, const char *name, const st
|
|||
s->mcalign = pa_mcalign_new(pa_frame_size(ss), c->memblock_stat);
|
||||
|
||||
s->counter = 0;
|
||||
s->previous_time = 0;
|
||||
s->previous_ipol_time = 0;
|
||||
|
||||
s->corked = 0;
|
||||
s->interpolate = 0;
|
||||
|
|
@ -697,6 +699,11 @@ pa_usec_t pa_stream_get_time(struct pa_stream *s, const struct pa_latency_info *
|
|||
}
|
||||
}
|
||||
|
||||
if (usec < s->previous_time)
|
||||
usec = s->previous_time;
|
||||
|
||||
s->previous_time = usec;
|
||||
|
||||
return usec;
|
||||
}
|
||||
|
||||
|
|
@ -756,6 +763,11 @@ pa_usec_t pa_stream_get_interpolated_time(struct pa_stream *s) {
|
|||
usec = s->ipol_usec + pa_timeval_age(&s->ipol_timestamp);
|
||||
}
|
||||
|
||||
if (usec < s->previous_ipol_time)
|
||||
usec = s->previous_ipol_time;
|
||||
|
||||
s->previous_ipol_time = usec;
|
||||
|
||||
return usec;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue