summaryrefslogtreecommitdiff
path: root/axfer/xfer-libasound-irq-rw.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2018-11-13 15:41:36 +0900
committerTakashi Iwai <tiwai@suse.de>2018-11-13 12:04:37 +0100
commit0e3a1d9e0b692307aa8ae483b3df3c9a53d4256e (patch)
treef144a7fde101b2a3aff1bf1e460cbc728d1c72ba /axfer/xfer-libasound-irq-rw.c
parentb5d2fadfb18b5e2b2f03037256998b2fbcb9b226 (diff)
downloadalsa-utils-0e3a1d9e0b692307aa8ae483b3df3c9a53d4256e.tar.gz
axfer: add an option to suppress event waiting
In aplay, '--test-nowait' is used to suppress calls of snd_pcm_wait() when I/O operations return -EAGAIN or process truncated number of data frames. This seems to be for debugging purpose. In this program, this option is equivalent to suppress event waiting. This commit adds support for this option. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'axfer/xfer-libasound-irq-rw.c')
-rw-r--r--axfer/xfer-libasound-irq-rw.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/axfer/xfer-libasound-irq-rw.c b/axfer/xfer-libasound-irq-rw.c
index f05ac4b..625c095 100644
--- a/axfer/xfer-libasound-irq-rw.c
+++ b/axfer/xfer-libasound-irq-rw.c
@@ -133,10 +133,12 @@ static int r_process_frames_nonblocking(struct libasound_state *state,
goto error;
}
- // Wait for hardware IRQ when no available space.
- err = snd_pcm_wait(state->handle, -1);
- if (err < 0)
- goto error;
+ if (state->use_waiter) {
+ // Wait for hardware IRQ when no available space.
+ err = snd_pcm_wait(state->handle, -1);
+ if (err < 0)
+ goto error;
+ }
// Check available space on the buffer.
avail = snd_pcm_avail(state->handle);
@@ -286,10 +288,12 @@ static int w_process_frames_nonblocking(struct libasound_state *state,
unsigned int avail_count;
int err;
- // Wait for hardware IRQ when no left space.
- err = snd_pcm_wait(state->handle, -1);
- if (err < 0)
- goto error;
+ if (state->use_waiter) {
+ // Wait for hardware IRQ when no left space.
+ err = snd_pcm_wait(state->handle, -1);
+ if (err < 0)
+ goto error;
+ }
// Check available space on the buffer.
avail = snd_pcm_avail(state->handle);