diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-03-15 15:19:40 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-03-15 15:19:40 +0000 |
commit | 12c01e942d23bd477e14b467e66352e6ce0557a9 (patch) | |
tree | 3231d52f87a1115744b5e4f4b61a0bccf04a57bc /src/pulsecore/time-smoother.c | |
parent | 347cfc356aa1c5073a5fc1d4355392759df13ab8 (diff) |
commit glitch-free work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2122 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/time-smoother.c')
-rw-r--r-- | src/pulsecore/time-smoother.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c index 4cebded4..b44aaa50 100644 --- a/src/pulsecore/time-smoother.c +++ b/src/pulsecore/time-smoother.c @@ -332,6 +332,8 @@ void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) { s->py = y + s->dp *s->adjust_time; s->abc_valid = FALSE; + + pa_log_debug("put(%llu | %llu) = %llu", x + s->time_offset, x, y); } pa_usec_t pa_smoother_get(pa_smoother *s, pa_usec_t x) { @@ -350,6 +352,9 @@ pa_usec_t pa_smoother_get(pa_smoother *s, pa_usec_t x) { pa_assert(x >= s->ex); estimate(s, x, &y, NULL); + + pa_log_debug("get(%llu | %llu) = %llu", x + s->time_offset, x, y); + return y; } @@ -357,6 +362,8 @@ void pa_smoother_set_time_offset(pa_smoother *s, pa_usec_t offset) { pa_assert(s); s->time_offset = offset; + + pa_log_debug("offset(%llu)", offset); } void pa_smoother_pause(pa_smoother *s, pa_usec_t x) { @@ -365,6 +372,8 @@ void pa_smoother_pause(pa_smoother *s, pa_usec_t x) { if (s->paused) return; + pa_log_debug("pause(%llu)", x); + s->paused = TRUE; s->pause_time = x; } @@ -377,6 +386,31 @@ void pa_smoother_resume(pa_smoother *s, pa_usec_t x) { pa_assert(x >= s->pause_time); + pa_log_debug("resume(%llu)", x); + s->paused = FALSE; s->time_offset += x - s->pause_time; } + +pa_usec_t pa_smoother_translate(pa_smoother *s, pa_usec_t x, pa_usec_t y_delay) { + pa_usec_t ney; + double nde; + + pa_assert(s); + pa_assert(x >= s->time_offset); + + /* Fix up x value */ + if (s->paused) + x = s->pause_time; + + pa_assert(x >= s->time_offset); + x -= s->time_offset; + + pa_assert(x >= s->ex); + + estimate(s, x, &ney, &nde); + + pa_log_debug("translate(%llu) = %llu (%0.2f)", (unsigned long long) y_delay, (unsigned long long) ((double) y_delay / s->dp), s->dp); + + return (pa_usec_t) ((double) y_delay / s->dp); +} |