aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortinyalsa <simonwilson@google.com>2012-05-15 17:24:14 -0700
committertinyalsa <simonwilson@google.com>2012-05-15 17:24:14 -0700
commit80d8254df0294dcb97053c7b42e818595f4792cf (patch)
treea2ded6e69d034e2a2e12bbf18f4a815f2f79fc6a
parentfcebcad9913c86acd16ca21849bcea16a153f6e5 (diff)
parent2581a1e4f5a936d8af68c187a8d10c8706c235b3 (diff)
Merge pull request #14 from kyoungpark/master
pcm: add error check for pcm_start in pcm_read
-rw-r--r--pcm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcm.c b/pcm.c
index 2dca157..af175f2 100644
--- a/pcm.c
+++ b/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");
+ return -errno;
+ }
}
if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_READI_FRAMES, &x)) {
pcm->running = 0;