From 5ad13c4825085ac28ed12afb0daf73c315fe0ed6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 6 Oct 2010 20:34:03 +0200 Subject: [PATCH] alsaloop: fix -a option and slave mode processing Signed-off-by: Jaroslav Kysela --- alsaloop/alsaloop.c | 4 ++-- alsaloop/pcmjob.c | 3 +++ alsaloop/test.sh | 18 +++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c index 743e0ef..48bd21a 100644 --- a/alsaloop/alsaloop.c +++ b/alsaloop/alsaloop.c @@ -424,9 +424,9 @@ static int parse_config(int argc, char *argv[], snd_output_t *output) case 'a': if (optarg[0] == 'a') arg_slave = SLAVE_TYPE_AUTO; - else if (strcasecmp(optarg, "off")) + else if (strcasecmp(optarg, "on") == 0) arg_slave = SLAVE_TYPE_ON; - else if (strcasecmp(optarg, "on")) + else if (strcasecmp(optarg, "off") == 0) arg_slave = SLAVE_TYPE_OFF; else arg_slave = atoi(optarg); diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c index 47256e0..51d9ea6 100644 --- a/alsaloop/pcmjob.c +++ b/alsaloop/pcmjob.c @@ -1432,6 +1432,8 @@ int pcmjob_pollfds_handle(struct loopback *loop, struct pollfd *fds) } if (verbose > 9) snd_output_printf(loop->output, "%s: prevents = 0x%x, crevents = 0x%x\n", loop->id, prevents, crevents); + if (prevents == 0 && crevents == 0) + goto __pcm_end; do { ccount = readit(capt); buf_add(loop, ccount); @@ -1520,6 +1522,7 @@ int pcmjob_pollfds_handle(struct loopback *loop, struct pollfd *fds) else snd_output_printf(loop->output, "%s: end delay %li\n", capt->id, cdelay); } + __pcm_end: if (verbose > 13) { getcurtimestamp(&loop->tstamp_end); snd_output_printf(loop->output, "%s: processing time %lius\n", capt->id, timediff(loop->tstamp_end, loop->tstamp_start)); diff --git a/alsaloop/test.sh b/alsaloop/test.sh index bc42480..a1d4dbe 100755 --- a/alsaloop/test.sh +++ b/alsaloop/test.sh @@ -28,19 +28,19 @@ EOF } test3() { - echo "TEST2" + echo "TEST3" cat > $CFGFILE <