diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-04-14 01:04:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-04-14 01:04:17 +0200 |
commit | a4cea4e469d3baf27890820eba030b7acdf63daa (patch) | |
tree | 682327c0a74d8b1f05284f1ea910f24c8b0d01e7 /src/pulsecore | |
parent | 2d94c939575e979132191b59a55d89ed34fa51ed (diff) |
core: when applying delay memblockq take monitored sink latency into account
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/source-output.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index cc0ebe62..4ba25ae4 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -440,6 +440,25 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { limit = o->process_rewind ? 0 : o->source->thread_info.max_rewind; + if (limit > 0 && o->source->monitor_of) { + pa_usec_t latency; + size_t n; + + /* Hmm, check the latency for knowing how much of the buffered + * data is actually still unplayed and might hence still + * change. This is suboptimal. Ideally we'd have a call like + * pa_sink_get_changeable_size() or so that tells us how much + * of the queued data is actually still changeable. Hence + * FIXME! */ + + latency = pa_sink_get_latency_within_thread(o->source->monitor_of); + + n = pa_usec_to_bytes(latency, &o->source->sample_spec); + + if (n < limit) + limit = n; + } + /* Implement the delay queue */ while ((length = pa_memblockq_get_length(o->thread_info.delay_memblockq)) > limit) { pa_memchunk qchunk; |