summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-12-24 00:58:34 +0100
committerLennart Poettering <lennart@poettering.net>2008-12-24 00:58:34 +0100
commit2ff20ceccb7334b0d491fec119a324cda1045803 (patch)
tree9dab44ae820f8d21b9ed2e4a5a077c2a168a110f
parentfb4c111d18932ca5643a44ad589a1fff5888260f (diff)
Rework handling of the PA_SINK_LATENCY/PA_SOURCE_LATENCY flags
-rw-r--r--src/pulsecore/sink.c11
-rw-r--r--src/pulsecore/source.c3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 37387766..a4d993cd 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -240,7 +240,7 @@ pa_sink* pa_sink_new(
pa_proplist_setf(source_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Monitor of %s", dn ? dn : s->name);
pa_proplist_sets(source_data.proplist, PA_PROP_DEVICE_CLASS, "monitor");
- s->monitor_source = pa_source_new(core, &source_data, 0);
+ s->monitor_source = pa_source_new(core, &source_data, PA_SOURCE_LATENCY);
pa_source_new_data_done(&source_data);
@@ -836,6 +836,9 @@ pa_usec_t pa_sink_get_latency(pa_sink *s) {
if (!PA_SINK_IS_OPENED(s->state))
return 0;
+ if (!(s->flags & PA_SINK_LATENCY))
+ return 0;
+
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) == 0);
return usec;
@@ -1162,7 +1165,8 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
size_t sink_nbytes, total_nbytes;
/* Get the latency of the sink */
- if (PA_MSGOBJECT(s)->process_msg(PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
+ if (!(s->flags & PA_SINK_LATENCY) ||
+ PA_MSGOBJECT(s)->process_msg(PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
usec = 0;
sink_nbytes = pa_usec_to_bytes(usec, &s->sample_spec);
@@ -1221,7 +1225,8 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
size_t nbytes;
/* Get the latency of the sink */
- if (PA_MSGOBJECT(s)->process_msg(PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
+ if (!(s->flags & PA_SINK_LATENCY) ||
+ PA_MSGOBJECT(s)->process_msg(PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_LATENCY, &usec, 0, NULL) < 0)
usec = 0;
nbytes = pa_usec_to_bytes(usec, &s->sample_spec);
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 5538ced1..815ec271 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -501,6 +501,9 @@ pa_usec_t pa_source_get_latency(pa_source *s) {
if (!PA_SOURCE_IS_OPENED(s->state))
return 0;
+ if (!(s->flags & PA_SOURCE_LATENCY))
+ return 0;
+
pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_LATENCY, &usec, 0, NULL) == 0);
return usec;