forked from pool/pulseaudio
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
From e4b4d054871a506e8bcede10c917d887d2d6d6e3 Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Fri, 8 May 2009 02:02:36 +0200
|
|
Subject: [PATCH] core: cache requested latency only when we are running, not while we are still constructing
|
|
|
|
---
|
|
src/pulsecore/sink.c | 7 +++++--
|
|
src/pulsecore/source.c | 7 +++++--
|
|
2 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
|
|
index 2225886..161b7c9 100644
|
|
--- a/src/pulsecore/sink.c
|
|
+++ b/src/pulsecore/sink.c
|
|
@@ -1867,8 +1867,11 @@ pa_usec_t pa_sink_get_requested_latency_within_thread(pa_sink *s) {
|
|
if (result != (pa_usec_t) -1)
|
|
result = PA_CLAMP(result, s->thread_info.min_latency, s->thread_info.max_latency);
|
|
|
|
- s->thread_info.requested_latency = result;
|
|
- s->thread_info.requested_latency_valid = TRUE;
|
|
+ if (PA_SINK_IS_LINKED(s->thread_info.state)) {
|
|
+ /* Only cache if properly initialized */
|
|
+ s->thread_info.requested_latency = result;
|
|
+ s->thread_info.requested_latency_valid = TRUE;
|
|
+ }
|
|
|
|
return result;
|
|
}
|
|
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
|
|
index e8deaf7..8a4c8c4 100644
|
|
--- a/src/pulsecore/source.c
|
|
+++ b/src/pulsecore/source.c
|
|
@@ -1122,8 +1122,11 @@ pa_usec_t pa_source_get_requested_latency_within_thread(pa_source *s) {
|
|
if (result != (pa_usec_t) -1)
|
|
result = PA_CLAMP(result, s->thread_info.min_latency, s->thread_info.max_latency);
|
|
|
|
- s->thread_info.requested_latency = result;
|
|
- s->thread_info.requested_latency_valid = TRUE;
|
|
+ if (PA_SOURCE_IS_LINKED(s->thread_info.state)) {
|
|
+ /* Only cache this if we are fully set up */
|
|
+ s->thread_info.requested_latency = result;
|
|
+ s->thread_info.requested_latency_valid = TRUE;
|
|
+ }
|
|
|
|
return result;
|
|
}
|
|
--
|
|
1.6.0.2
|
|
|