diff mbox series

Aplay: pcm_readv(): return read samples instead of requested upon abort

Message ID c6f45adf-776d-4ce5-783f-1be1b8d7eb29@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series Aplay: pcm_readv(): return read samples instead of requested upon abort | expand

Commit Message

Rajwa, Marcin Aug. 7, 2020, 4:09 p.m. UTC
aplay: pcm_readv(): return read samples instead of requested upon abort

     This patch changes the logic of pcm_readv() when abort signal has been
     detected. During such condition we should return the amount of frames
     actually read instead of the size requested by caller.

     Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>

                 size_t offset = result;
diff mbox series

Patch

diff --git a/aplay/aplay.c b/aplay/aplay.c
index e8714d8..5d4b56e 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2174,7 +2174,9 @@  static ssize_t pcm_readv(u_char **data, unsigned 
int channels, size_t rcount)
                 count = chunk_size;
         }

-       while (count > 0 && !in_aborting) {
+       while (count > 0) {
+               if (in_aborting)
+                       return result;
                 unsigned int channel;
                 void *bufs[channels];