diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-04-09 01:16:43 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-04-09 01:16:43 +0000 |
commit | da37a7e93db0f17e03f94f7835d7075faa3ac4ba (patch) | |
tree | 040b705c610962c101bf1225709efc2858de7e49 /src/pulsecore/sink-input.c | |
parent | ad18107223e8c4199b86bb3616677a2b57293fad (diff) |
export both min and max latency that is configured for a sink; add API for querying the requested latency of a sink/source from the main thread
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2225 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore/sink-input.c')
-rw-r--r-- | src/pulsecore/sink-input.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 989e2ae5..ddd9980f 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -677,13 +677,21 @@ void pa_sink_input_set_max_rewind(pa_sink_input *i, size_t nbytes /* in the sin pa_usec_t pa_sink_input_set_requested_latency(pa_sink_input *i, pa_usec_t usec) { pa_sink_input_assert_ref(i); - if (usec < i->sink->min_latency) - usec = i->sink->min_latency; + if (usec > 0) { + + if (i->sink->max_latency > 0 && usec > i->sink->max_latency) + usec = i->sink->max_latency; + + if (i->sink->min_latency > 0 && usec < i->sink->min_latency) + usec = i->sink->min_latency; + } if (PA_SINK_INPUT_LINKED(i->state)) pa_asyncmsgq_post(i->sink->asyncmsgq, PA_MSGOBJECT(i), PA_SINK_INPUT_MESSAGE_SET_REQUESTED_LATENCY, NULL, (int64_t) usec, NULL, NULL); - else + else { i->thread_info.requested_sink_latency = usec; + i->sink->thread_info.requested_latency_valid = FALSE; + } return usec; } |