core: make fixed latency dynamically changeable

This of course makes the name 'fixed' a bit of a misnomer. However the
definitions are now like this:

fixed latency: the latency may change during runtime, but is solely
controlled by the backend, the client has no influence.

dynamic latency: the latency may change during runtime, influenced by
the requests of the clients.

i.e. fixed vs. dynamic is from the perspective of the client.
This commit is contained in:
Lennart Poettering 2009-08-15 00:48:14 +02:00
parent 4eb59fb90e
commit 350a2bc846
10 changed files with 212 additions and 52 deletions

View file

@ -114,6 +114,7 @@ static void reset_callbacks(pa_sink_input *i) {
i->update_max_request = NULL;
i->update_sink_requested_latency = NULL;
i->update_sink_latency_range = NULL;
i->update_sink_fixed_latency = NULL;
i->attach = NULL;
i->detach = NULL;
i->suspend = NULL;
@ -851,13 +852,13 @@ pa_usec_t pa_sink_input_set_requested_latency_within_thread(pa_sink_input *i, pa
pa_sink_input_assert_io_context(i);
if (!(i->sink->flags & PA_SINK_DYNAMIC_LATENCY))
usec = i->sink->fixed_latency;
usec = i->sink->thread_info.fixed_latency;
if (usec != (pa_usec_t) -1)
usec = PA_CLAMP(usec, i->sink->thread_info.min_latency, i->sink->thread_info.max_latency);
i->thread_info.requested_sink_latency = usec;
pa_sink_invalidate_requested_latency(i->sink);
pa_sink_invalidate_requested_latency(i->sink, TRUE);
return usec;
}
@ -877,7 +878,7 @@ pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec)
if (i->sink) {
if (!(i->sink->flags & PA_SINK_DYNAMIC_LATENCY))
usec = i->sink->fixed_latency;
usec = pa_sink_get_fixed_latency(i->sink);
if (usec != (pa_usec_t) -1) {
pa_usec_t min_latency, max_latency;