From d035f4a3f3e73fd67d69a03c03adc9a08f30ef21 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 5 Apr 2009 02:26:02 +0200 Subject: Modify smoothing code to make cubic interpolation optional and allow 'quick fixups' on resuming The primary reason for this change is to allow time graphs that do not go through the origin and hence smoothing starting from the origin is not desired. This change will allow passing time data into the smoother while paused and then abruptly use that data without smoothing using the 'quick fixup' flag when resuming. Primary use case is allowing recording time graphs where the data recorded originates from a time before the stream was created. The resulting graft will be shifted and should not be smoothened to go through the origin. --- src/pulse/stream.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/pulse') diff --git a/src/pulse/stream.c b/src/pulse/stream.c index c4a54af6..ff3644ff 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -393,7 +393,8 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t if (s->suspended || s->corked || force_stop) pa_smoother_pause(s->smoother, x); else if (force_start || s->buffer_attr.prebuf == 0) - pa_smoother_resume(s->smoother, x); + pa_smoother_resume(s->smoother, x, TRUE); + /* Please note that we have no idea if playback actually started * if prebuf is non-zero! */ @@ -1064,14 +1065,17 @@ static int create_stream( if (flags & PA_STREAM_INTERPOLATE_TIMING) { pa_usec_t x; - if (s->smoother) - pa_smoother_free(s->smoother); - - s->smoother = pa_smoother_new(SMOOTHER_ADJUST_TIME, SMOOTHER_HISTORY_TIME, !(flags & PA_STREAM_NOT_MONOTONIC), SMOOTHER_MIN_HISTORY); - x = pa_rtclock_usec(); - pa_smoother_set_time_offset(s->smoother, x); - pa_smoother_pause(s->smoother, x); + + pa_assert(!s->smoother); + s->smoother = pa_smoother_new( + SMOOTHER_ADJUST_TIME, + SMOOTHER_HISTORY_TIME, + !(flags & PA_STREAM_NOT_MONOTONIC), + TRUE, + SMOOTHER_MIN_HISTORY, + x, + TRUE); } if (!dev) @@ -1623,7 +1627,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, pa_smoother_put(o->stream->smoother, u, calc_time(o->stream, TRUE)); if (i->playing) - pa_smoother_resume(o->stream->smoother, x); + pa_smoother_resume(o->stream->smoother, x, TRUE); } } -- cgit