SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0019-alsaloop-Fix-thread-handling.patch
Takashi Iwai 3331bcfb82 - backport GIT PATCHES:
* A few alsactl init fix patches:
  * amixer control-id parse fix
  * new aloop utility
  * robusitfy speaker-test 
  * misc clean up, translation updates
- Use systemd for openSUSE 11.4
- Put udev rules into this package instead of alsa.rpm

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=23
2010-11-26 08:10:21 +00:00

81 lines
2.3 KiB
Diff

From 4fe4d22b73dd205521348583f8105de1c155f4a6 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 6 Oct 2010 18:51:29 +0200
Subject: [PATCH 19/38] alsaloop: Fix thread handling
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaloop/alsaloop.c | 5 ++---
alsaloop/test.sh | 19 +++++++++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c
index 0001358..743e0ef 100644
--- a/alsaloop/alsaloop.c
+++ b/alsaloop/alsaloop.c
@@ -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);
diff --git a/alsaloop/test.sh b/alsaloop/test.sh
index 2033add..bc42480 100755
--- a/alsaloop/test.sh
+++ b/alsaloop/test.sh
@@ -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
--
1.7.3.1