Skip to content
Browse files

add error check for pcm_start

- Otherwise, read will be tried even after pcm_start is failed.
  This leads into blocking inside the read ioctl forever.
  pcm_start can fail, for example in full-speed USB audio device,
  in some H/W, due to the lack of bandwidth in USB bus,
  • Loading branch information...
1 parent b6db70a commit 2581a1e4f5a936d8af68c187a8d10c8706c235b3 @kyoungpark committed May 10, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 pcm.c
View
5 pcm.c
@@ -405,7 +405,10 @@ int pcm_read(struct pcm *pcm, void *data, unsigned int count)
for (;;) {
if (!pcm->running) {
- pcm_start(pcm);
+ if (pcm_start(pcm) < 0) {
+ fprintf(stderr, "start error");
@tinyalsa
tinyalsa added a note May 16, 2012

This is missing a \n, but I've noticed a couple of lines like that so I'll merge this and then fix those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ return -errno;
+ }
}
if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_READI_FRAMES, &x)) {
pcm->running = 0;

0 comments on commit 2581a1e

Please sign in to comment.
Something went wrong with that request. Please try again.