]> git.tue.mpg.de Git - paraslash.git/commitdiff
Speed up audiod_pre_select.
authorAndre Noll <maan@systemlinux.org>
Sun, 10 Feb 2008 13:20:09 +0000 (14:20 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 10 Feb 2008 13:20:09 +0000 (14:20 +0100)
Catch the common case early in the function to minimize the
number of checks for that case.

audiod.c

index 701f827848b112b735e3fa16cae371934200e8a8..dee31d5c5606727d1f320e1ad16abb09a0c6b97b 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -599,6 +599,8 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                a = &afi[sl->format];
                if (!sl->receiver_node)
                        continue;
+               if ((!a->num_filters || sl->fc) && sl->wng)
+                       continue; /* everything already started */
                if (!a->num_filters) {
                        if (sl->receiver_node->loaded && !sl->wng) {
                                open_writers(i);
@@ -611,7 +613,7 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                        s->timeout = min_delay;
                        continue;
                }
-               if (!sl->fc || !*sl->fc->out_loaded || sl->wng)
+               if (sl->wng || !sl->fc || !*sl->fc->out_loaded)
                        continue;
                if (tv_diff(now, &initial_delay_barrier, &diff) > 0) {
                        open_writers(i);