From f19e7ed870dcf53ab1ef8ff172533dde80cae71d Mon Sep 17 00:00:00 2001 From: Miguel GAIO Date: Tue, 10 Apr 2018 06:35:07 +0200 Subject: [PATCH] Fix pcm_writei return value if pcm is in not running state. As per comment, on success, pcm_writei returns the number of frames written. Fix the case of pcm not running. Signed-off-by: Miguel GAIO --- src/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm.c b/src/pcm.c index 7a67cfe..f665cb4 100644 --- a/src/pcm.c +++ b/src/pcm.c @@ -695,7 +695,7 @@ int pcm_writei(struct pcm *pcm, const void *data, unsigned int frame_count) if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &x)) return oops(pcm, errno, "cannot write initial data"); pcm->running = 1; - return 0; + return x.result; } if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &x)) { pcm->prepared = 0;