diff options
| -rw-r--r-- | polyp/polyplib-internal.h | 2 | ||||
| -rw-r--r-- | polyp/polyplib-stream.c | 12 | 
2 files changed, 14 insertions, 0 deletions
| diff --git a/polyp/polyplib-internal.h b/polyp/polyplib-internal.h index 9417430f..8677c813 100644 --- a/polyp/polyplib-internal.h +++ b/polyp/polyplib-internal.h @@ -92,6 +92,8 @@ struct pa_stream {      enum pa_stream_direction direction;      uint32_t requested_bytes;      uint64_t counter; +    pa_usec_t previous_time; +    pa_usec_t previous_ipol_time;      enum pa_stream_state state;      struct pa_mcalign *mcalign; diff --git a/polyp/polyplib-stream.c b/polyp/polyplib-stream.c index 7058b546..b6a091b3 100644 --- a/polyp/polyplib-stream.c +++ b/polyp/polyplib-stream.c @@ -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;  } | 
