summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-08-29 01:20:25 +0200
committerLennart Poettering <lennart@poettering.net>2008-08-29 01:20:25 +0200
commit450fe170a5d8a38a9e49ddaae02ed7524e78a51f (patch)
tree418f8fd5f8abe3f12a6aaea5e402bd3dd744fd68 /src/pulsecore/sink.c
parent63505bee07adf94f33ba4a8bdd4ab8dfdf0e57a1 (diff)
fix up latency before calling into stream code, to make sure we don't ask for too much data to early
Diffstat (limited to 'src/pulsecore/sink.c')
-rw-r--r--src/pulsecore/sink.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 24fb8913..6fa22dc2 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -1042,11 +1042,15 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
pa_sink_input_set_state_within_thread(i, i->state);
+ /* The requested latency of the sink input needs to be
+ * fixed up and then configured on the sink */
+
+ if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+ pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
pa_sink_input_update_max_request(i, s->thread_info.max_request);
- pa_sink_invalidate_requested_latency(s);
-
/* We don't rewind here automatically. This is left to the
* sink input implementor because some sink inputs need a
* slow start, i.e. need some time to buffer client
@@ -1158,11 +1162,12 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
if (i->attach)
i->attach(i);
+ if (i->thread_info.requested_sink_latency != (pa_usec_t) -1)
+ pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
+
pa_sink_input_update_max_rewind(i, s->thread_info.max_rewind);
pa_sink_input_update_max_request(i, s->thread_info.max_request);
- pa_sink_input_set_requested_latency_within_thread(i, i->thread_info.requested_sink_latency);
-
if (i->thread_info.state != PA_SINK_INPUT_CORKED) {
pa_usec_t usec = 0;
size_t nbytes;
@@ -1424,7 +1429,6 @@ void pa_sink_set_max_rewind(pa_sink *s, size_t max_rewind) {
/* Called from IO thread */
void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
- pa_sink_input *i;
void *state = NULL;
pa_sink_assert_ref(s);
@@ -1435,6 +1439,8 @@ void pa_sink_set_max_request(pa_sink *s, size_t max_request) {
s->thread_info.max_request = max_request;
if (PA_SINK_IS_LINKED(s->thread_info.state)) {
+ pa_sink_input *i;
+
while ((i = pa_hashmap_iterate(s->thread_info.inputs, &state, NULL)))
pa_sink_input_update_max_request(i, s->thread_info.max_request);
}