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/modules/module-tunnel.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/modules/module-tunnel.c') diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 1d658ba0..5ea58aa0 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -405,7 +405,7 @@ static void check_smoother_status(struct userdata *u, pa_bool_t past) { if (u->remote_suspended || u->remote_corked) pa_smoother_pause(u->smoother, x); else - pa_smoother_resume(u->smoother, x); + pa_smoother_resume(u->smoother, x, TRUE); } /* Called from IO thread context */ @@ -1815,7 +1815,14 @@ int pa__init(pa_module*m) { u->source_name = pa_xstrdup(pa_modargs_get_value(ma, "source", NULL));; u->source = NULL; #endif - u->smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, TRUE, 10); + u->smoother = pa_smoother_new( + PA_USEC_PER_SEC, + PA_USEC_PER_SEC*2, + TRUE, + TRUE, + 10, + pa_rtclock_usec(), + FALSE); u->ctag = 1; u->device_index = u->channel = PA_INVALID_INDEX; u->time_event = NULL; @@ -1933,8 +1940,6 @@ int pa__init(pa_module*m) { u->fragsize = (uint32_t) -1; #endif - pa_smoother_set_time_offset(u->smoother, pa_rtclock_usec()); - if (!(u->thread = pa_thread_new(thread_func, u))) { pa_log("Failed to create thread."); goto fail; -- cgit