diff options
author | Ricardo Biehl Pasquali <pasqualirb@gmail.com> | 2018-09-09 21:40:01 -0300 |
---|---|---|
committer | Ricardo Biehl Pasquali <pasqualirb@gmail.com> | 2019-01-08 13:06:18 -0200 |
commit | 7c40a9ecde0150049bf1b04a9fbf0fd437c16043 (patch) | |
tree | c2781ff77862745210be8f38d1b4ca97be2cfd6b /src | |
parent | 13bf6299d4f6907bcdc97729a17c6172d46637c9 (diff) |
pcm: Move prepare action to xrun handling
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
Diffstat (limited to 'src')
-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"); |