From 3766850c8b98b3fe8abb3b5634d4801cbdb95377 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 8 May 2009 01:56:21 +0200 Subject: core: introduce pa_{sink,source}_set_fixed_latency() This allows us to forward the fixed latency directly from the sink to the monitor source withut having to wait for pa_sink_put(). --- src/pulsecore/source.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/pulsecore/source.c') diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 21902509..a772dc65 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -1276,6 +1276,21 @@ void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_laten pa_source_invalidate_requested_latency(s); } +/* Called from main thread, before the source is put */ +void pa_source_set_fixed_latency(pa_source *s, pa_usec_t latency) { + pa_source_assert_ref(s); + + pa_assert(pa_source_get_state(s) == PA_SOURCE_INIT); + + if (latency < ABSOLUTE_MIN_LATENCY) + latency = ABSOLUTE_MIN_LATENCY; + + if (latency > ABSOLUTE_MAX_LATENCY) + latency = ABSOLUTE_MAX_LATENCY; + + s->fixed_latency = latency; +} + /* Called from main thread */ size_t pa_source_get_max_rewind(pa_source *s) { size_t r; -- cgit