sink, source: Add a latency offset which is inherited from the port

A latency offset variable was added to the sink/source struct.

Also a function was introduced to update the latency offset of the
sink/source and a new message type was introduced so we can send the latency
offset to the IO thread.

The latency offset is automatically populated with the latency from the
currently active port.
This commit is contained in:
poljar 2012-06-22 20:55:54 +02:00 committed by Tanu Kaskinen
parent bc03487896
commit eebdda456b
5 changed files with 92 additions and 0 deletions

View file

@ -115,7 +115,28 @@ void pa_device_port_hashmap_free(pa_hashmap *h) {
}
void pa_device_port_set_latency_offset(pa_device_port *p, pa_usec_t offset) {
uint32_t state;
pa_assert(p);
p->latency_offset = offset;
if (p->is_output) {
pa_sink *sink;
PA_IDXSET_FOREACH(sink, p->core->sinks, state)
if (sink->active_port == p) {
pa_sink_set_latency_offset(sink, p->latency_offset);
break;
}
} else {
pa_source *source;
PA_IDXSET_FOREACH(source, p->core->sources, state)
if (source->active_port == p) {
pa_source_set_latency_offset(source, p->latency_offset);
break;
}
}
}