alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Aplay: pcm_readv(): return read samples instead of requested upon abort
@ 2020-08-07 16:09 Rajwa, Marcin
  2020-08-07 16:12 ` [PATCH] Aplay: pcm_read(): " Rajwa, Marcin
  0 siblings, 1 reply; 2+ messages in thread
From: Rajwa, Marcin @ 2020-08-07 16:09 UTC (permalink / raw)
  To: alsa-devel, perex, pierre-louis.bossart, broonie

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>

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];
                 size_t offset = result;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] Aplay: pcm_read(): return read samples instead of requested upon abort
  2020-08-07 16:09 [PATCH] Aplay: pcm_readv(): return read samples instead of requested upon abort Rajwa, Marcin
@ 2020-08-07 16:12 ` Rajwa, Marcin
  0 siblings, 0 replies; 2+ messages in thread
From: Rajwa, Marcin @ 2020-08-07 16:12 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, pierre-louis.bossart

aplay: pcm_read(): return read samples instead of requested upon abort

     This patch changes the logic of pcm_read() 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>

diff --git a/aplay/aplay.c b/aplay/aplay.c
index 5d4b56e..6836558 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2135,7 +2135,9 @@ static ssize_t pcm_read(u_char *data, size_t rcount)
                 count = chunk_size;
         }

-       while (count > 0 && !in_aborting) {
+       while (count > 0) {
+               if (in_aborting)
+                       return result;
                 if (test_position)
                         do_test_position();
                 check_stdin();


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-07 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 16:09 [PATCH] Aplay: pcm_readv(): return read samples instead of requested upon abort Rajwa, Marcin
2020-08-07 16:12 ` [PATCH] Aplay: pcm_read(): " Rajwa, Marcin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).