]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsaloop: Fix thread handling
authorJaroslav Kysela <perex@perex.cz>
Wed, 6 Oct 2010 16:51:29 +0000 (18:51 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 6 Oct 2010 16:51:29 +0000 (18:51 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsaloop/alsaloop.c
alsaloop/test.sh

index 0001358f8c15a1b84a810b4453c4d58a880b1a4c..743e0ef4c0948f67dd69965909b2227ae9f037ae 100644 (file)
@@ -687,7 +687,7 @@ int main(int argc, char *argv[])
        }
 
        /* we must sort thread IDs */
-       j = 0;
+       j = -1;
        do {
                k = 0x7fffffff;
                for (i = 0; i < loopbacks_count; i++) {
@@ -695,11 +695,11 @@ int main(int argc, char *argv[])
                            loopbacks[i]->thread > j)
                                k = loopbacks[i]->thread;
                }
+               j++;
                for (i = 0; i < loopbacks_count; i++) {
                        if (loopbacks[i]->thread == k)
                                loopbacks[i]->thread = j;
                }
-               j++;
        } while (k != 0x7fffffff);
        /* fix maximum thread id */
        for (i = 0, j = -1; i < loopbacks_count; i++) {
@@ -729,7 +729,6 @@ int main(int argc, char *argv[])
        for (k = 0; k < j; k++)
                thread_job(&threads[k]);
 
-       logit(LOG_CRIT, "threads = %i %i\n", j, loopbacks_count);
        if (j > 1) {
                for (k = 0; k < j; k++)
                        pthread_join(threads[k].thread, NULL);
index 2033add1f736a2347eca7dff0c2a2fa28e7aebaa..bc424800f2f0b070b58c133e0c243034419bc52a 100755 (executable)
@@ -27,8 +27,27 @@ EOF
   $DBG ./alsaloop -d --config $CFGFILE
 }
 
+test3() {
+  echo "TEST2"
+cat > $CFGFILE <<EOF
+-C hw:1,0,0 -P dmix:0 --tlatency 50000 --thread 0 \
+    --mixer "name='Master Playback Volume'@name='Master Playback Volume'" \
+    --mixer "name='Master Playback Switch'@name='Master Playback Switch'" \
+    --mixer "name='PCM Playback Volume'"
+-C hw:1,0,1 -P dmix:0 --tlatency 50000 --thread 1
+-C hw:1,0,2 -P dmix:0 --tlatency 50000 --thread 2
+-C hw:1,0,3 -P dmix:0 --tlatency 50000 --thread 3
+-C hw:1,0,4 -P dmix:0 --tlatency 50000 --thread 4
+-C hw:1,0,5 -P dmix:0 --tlatency 50000 --thread 5
+-C hw:1,0,6 -P dmix:0 --tlatency 50000 --thread 6
+-C hw:1,0,7 -P dmix:0 --tlatency 50000 --thread 7
+EOF
+  $DBG ./alsaloop --config $CFGFILE
+}
+
 case "$1" in
 test1) test1 ;;
 test2) test2 ;;
+test3) test3 ;;
 *) test1 ;;
 esac