summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulsecore/source.c')
-rw-r--r--src/pulsecore/source.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 1c3377be..252e23ab 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -617,6 +617,32 @@ pa_usec_t pa_source_get_latency(pa_source *s) {
return usec;
}
+/* Called from IO thread */
+pa_usec_t pa_source_get_latency_within_thread(pa_source *s) {
+ pa_usec_t usec = 0;
+ pa_msgobject *o;
+
+ pa_source_assert_ref(s);
+ pa_assert(PA_SOURCE_IS_LINKED(s->thread_info.state));
+
+ /* The returned value is supposed to be in the time domain of the sound card! */
+
+ if (s->thread_info.state == PA_SOURCE_SUSPENDED)
+ return 0;
+
+ if (!(s->flags & PA_SOURCE_LATENCY))
+ return 0;
+
+ o = PA_MSGOBJECT(s);
+
+ /* We probably should make this a proper vtable callback instead of going through process_msg() */
+
+ if (o->process_msg(o, PA_SOURCE_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
+ return -1;
+
+ return usec;
+}
+
/* Called from main thread */
void pa_source_set_volume(pa_source *s, const pa_cvolume *volume) {
pa_cvolume old_virtual_volume;