summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-08 01:56:21 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-08 02:04:48 +0200
commit3766850c8b98b3fe8abb3b5634d4801cbdb95377 (patch)
tree278e059557b2badb941617ba5fa01358b7c0e8c3 /src/pulsecore
parent92a61418882a68e913d2a40ae28e815a68c456f8 (diff)
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().
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/sink.c16
-rw-r--r--src/pulsecore/sink.h1
-rw-r--r--src/pulsecore/source.c15
-rw-r--r--src/pulsecore/source.h1
4 files changed, 33 insertions, 0 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 30fa5579..06c8b520 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -2050,6 +2050,22 @@ void pa_sink_set_latency_range_within_thread(pa_sink *s, pa_usec_t min_latency,
pa_source_set_latency_range_within_thread(s->monitor_source, min_latency, max_latency);
}
+/* Called from main thread, before the sink is put */
+void pa_sink_set_fixed_latency(pa_sink *s, pa_usec_t latency) {
+ pa_sink_assert_ref(s);
+
+ pa_assert(pa_sink_get_state(s) == PA_SINK_INIT);
+
+ if (latency < ABSOLUTE_MIN_LATENCY)
+ latency = ABSOLUTE_MIN_LATENCY;
+
+ if (latency > ABSOLUTE_MAX_LATENCY)
+ latency = ABSOLUTE_MAX_LATENCY;
+
+ s->fixed_latency = latency;
+ pa_source_set_fixed_latency(s->monitor_source, latency);
+}
+
/* Called from main context */
size_t pa_sink_get_max_rewind(pa_sink *s) {
size_t r;
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 352282b8..e33b3cfc 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -229,6 +229,7 @@ void pa_sink_set_rtpoll(pa_sink *s, pa_rtpoll *p);
void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind);
void pa_sink_set_max_request(pa_sink *s, size_t max_request);
void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_latency);
+void pa_sink_set_fixed_latency(pa_sink *s, pa_usec_t latency);
void pa_sink_detach(pa_sink *s);
void pa_sink_attach(pa_sink *s);
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;
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index b502c228..2978f57b 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -210,6 +210,7 @@ void pa_source_set_rtpoll(pa_source *s, pa_rtpoll *p);
void pa_source_set_max_rewind(pa_source *s, size_t max_rewind);
void pa_source_set_latency_range(pa_source *s, pa_usec_t min_latency, pa_usec_t max_latency);
+void pa_source_set_fixed_latency(pa_source *s, pa_usec_t latency);
void pa_source_detach(pa_source *s);
void pa_source_attach(pa_source *s);