1
From 411af6b61aa564907d65fad1893383a4eb0a4933 Mon Sep 17 00:00:00 2001
2
From: Tanu Kaskinen <tanu.kaskinen@digia.com>
3
Date: Thu, 29 Sep 2011 18:54:01 +0300
4
Subject: [PATCH 109/125] sink: Move updating the requested latency after the
5
rewind request when finishing a stream move.
8
src/pulsecore/sink.c | 29 +++++++++++++++++++++++------
9
1 files changed, 23 insertions(+), 6 deletions(-)
11
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
12
index 05b08aa..a2642b4 100644
13
--- a/src/pulsecore/sink.c
14
+++ b/src/pulsecore/sink.c
15
@@ -2330,6 +2330,18 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
16
* slow start, i.e. need some time to buffer client
17
* samples before beginning streaming. */
19
+ /* FIXME: Actually rewinding should be requested before
20
+ * updating the sink requested latency, because updating
21
+ * the requested latency updates also max_rewind of the
22
+ * sink. Now consider this: a sink has a 10 s buffer and
23
+ * nobody has requested anything less. Then a new stream
24
+ * appears while the sink buffer is full. The new stream
25
+ * requests e.g. 100 ms latency. That request is forwarded
26
+ * to the sink, so now max_rewind is 100 ms. When a rewind
27
+ * is requested, the sink will only rewind 100 ms, and the
28
+ * new stream will have to wait about 10 seconds before it
29
+ * becomes audible. */
31
/* In flat volume mode we need to update the volume as
33
return o->process_msg(o, PA_SINK_MESSAGE_SET_SHARED_VOLUME, NULL, 0, NULL);
34
@@ -2440,12 +2452,6 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
38
- if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
39
- pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
41
- pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
42
- pa_sink_input_update_max_request(i, s->thread_info.max_request);
44
if (i->thread_info.state != PA_SINK_INPUT_CORKED) {
47
@@ -2461,6 +2467,17 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
48
pa_sink_request_rewind(s, nbytes);
51
+ /* Updating the requested sink latency has to be done
52
+ * after the sink rewind request, not before, because
53
+ * otherwise the sink may limit the rewind amount
56
+ if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
57
+ pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
59
+ pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
60
+ pa_sink_input_update_max_request(i, s->thread_info.max_request);
62
return o->process_msg(o, PA_SINK_MESSAGE_SET_SHARED_VOLUME, NULL, 0, NULL);