Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Rajwa, Marcin" <marcin.rajwa@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: broonie@kernel.org, pierre-louis.bossart@linux.intel.com
Subject: [PATCH] Aplay: pcm_read(): return read samples instead of requested upon abort
Date: Fri, 7 Aug 2020 18:12:33 +0200	[thread overview]
Message-ID: <67dc575e-0309-e087-92d2-a468684be5fd@linux.intel.com> (raw)
In-Reply-To: <c6f45adf-776d-4ce5-783f-1be1b8d7eb29@linux.intel.com>

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();


      reply	other threads:[~2020-08-07 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67dc575e-0309-e087-92d2-a468684be5fd@linux.intel.com \
    --to=marcin.rajwa@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox