Blame SOURCES/0004-combine-sink-Make-the-latency-range-calculation-easi.patch

4bc40d
From 37225b927ecd3ab7780b9769dfda9136d26f6b5e Mon Sep 17 00:00:00 2001
4bc40d
From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
4bc40d
Date: Tue, 17 Jun 2014 12:17:58 +0300
4bc40d
Subject: [PATCH 4/7] combine-sink: Make the latency range calculation easier
4bc40d
 to read
4bc40d
4bc40d
I think this is much easier to understand. This should not result in
4bc40d
any functional change.
4bc40d
---
4bc40d
 src/modules/module-combine-sink.c | 15 ++++++++++-----
4bc40d
 1 file changed, 10 insertions(+), 5 deletions(-)
4bc40d
4bc40d
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
4bc40d
index cf318c5..37c2c79 100644
4bc40d
--- a/src/modules/module-combine-sink.c
4bc40d
+++ b/src/modules/module-combine-sink.c
4bc40d
@@ -722,15 +722,20 @@ static void update_latency_range(struct userdata *u) {
4bc40d
             max_latency = max;
4bc40d
     }
4bc40d
     if (max_latency == (pa_usec_t) -1) {
4bc40d
-        /* no outputs, use block size */
4bc40d
+        /* No outputs, use default limits. */
4bc40d
         min_latency = u->default_min_latency;
4bc40d
         max_latency = u->default_max_latency;
4bc40d
     }
4bc40d
-    else if (max_latency < min_latency)
4bc40d
-        max_latency = min_latency;
4bc40d
 
4bc40d
-    /* never go below the min_latency or BLOCK_USEC */
4bc40d
-    max_latency = MIN (max_latency, MAX (min_latency, BLOCK_USEC));
4bc40d
+    /* As long as we don't support rewinding, we should limit the max latency
4bc40d
+     * to a conservative value. */
4bc40d
+    if (max_latency > u->default_max_latency)
4bc40d
+        max_latency = u->default_max_latency;
4bc40d
+
4bc40d
+    /* Never ever try to set lower max latency than min latency, it just
4bc40d
+     * doesn't make sense. */
4bc40d
+    if (max_latency < min_latency)
4bc40d
+        max_latency = min_latency;
4bc40d
 
4bc40d
     pa_log_debug("Sink update latency range %lu %lu", min_latency, max_latency);
4bc40d
     pa_sink_set_latency_range_within_thread(u->sink, min_latency, max_latency);
4bc40d
-- 
4bc40d
1.9.3
4bc40d