aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/tinyalsa/asoundlib.h9
-rw-r--r--pcm.c6
2 files changed, 14 insertions, 1 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h
index f3587ab..a796a66 100644
--- a/include/tinyalsa/asoundlib.h
+++ b/include/tinyalsa/asoundlib.h
@@ -45,6 +45,15 @@ struct pcm;
45#define PCM_IN 0x10000000 45#define PCM_IN 0x10000000
46#define PCM_MMAP 0x00000001 46#define PCM_MMAP 0x00000001
47#define PCM_NOIRQ 0x00000002 47#define PCM_NOIRQ 0x00000002
48#define PCM_NORESTART 0x00000004 /* PCM_NORESTART - when set, calls to
49 * pcm_write for a playback stream will not
50 * attempt to restart the stream in the case
51 * of an underflow, but will return -EPIPE
52 * instead. After the first -EPIPE error, the
53 * stream is considered to be stopped, and a
54 * second call to pcm_write will attempt to
55 * restart the stream.
56 */
48 57
49/* PCM runtime states */ 58/* PCM runtime states */
50#define PCM_STATE_OPEN 0 59#define PCM_STATE_OPEN 0
diff --git a/pcm.c b/pcm.c
index f0dbcc5..6d4dbd5 100644
--- a/pcm.c
+++ b/pcm.c
@@ -388,8 +388,12 @@ int pcm_write(struct pcm *pcm, const void *data, unsigned int count)
388 if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &x)) { 388 if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &x)) {
389 pcm->running = 0; 389 pcm->running = 0;
390 if (errno == EPIPE) { 390 if (errno == EPIPE) {
391 /* we failed to make our window -- try to restart */ 391 /* we failed to make our window -- try to restart if we are
392 * allowed to do so. Otherwise, simply allow the EPIPE error to
393 * propagate up to the app level */
392 pcm->underruns++; 394 pcm->underruns++;
395 if (pcm->flags & PCM_NORESTART)
396 return -EPIPE;
393 continue; 397 continue;
394 } 398 }
395 return oops(pcm, errno, "cannot write stream data"); 399 return oops(pcm, errno, "cannot write stream data");