diff options
-rw-r--r-- | src/pcm.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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"); |