aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pcm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/pcm.c b/src/pcm.c
index f854a94..43e8279 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -704,9 +704,6 @@ int pcm_writei(struct pcm *pcm, const void *data, unsigned int frame_count)
x.result = 0;
for (;;) {
if (!pcm->running) {
- int prepare_error = pcm_prepare(pcm);
- if (prepare_error)
- return prepare_error;
if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &x))
return oops(pcm, errno, "cannot write initial data");
pcm->running = 1;
@@ -722,6 +719,8 @@ int pcm_writei(struct pcm *pcm, const void *data, unsigned int frame_count)
pcm->underruns++;
if (pcm->flags & PCM_NORESTART)
return -EPIPE;
+ if (pcm_prepare(pcm))
+ return -EPIPE;
continue;
}
return oops(pcm, errno, "cannot write stream data");