From patchwork Fri Aug 7 16:12:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rajwa, Marcin" X-Patchwork-Id: 11705841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0830E913 for ; Fri, 7 Aug 2020 16:14:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86E5220748 for ; Fri, 7 Aug 2020 16:14:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="idgk0kGC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86E5220748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DDC5F11C; Fri, 7 Aug 2020 18:13:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DDC5F11C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596816847; bh=JMHvolNqS04mSSddCSkH4LHdokHB2fsgvkqjLY7Pnio=; h=Subject:References:To:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=idgk0kGCVLx4VgpBQaNm4xCeTOpeyARmory65Lk4GEQxT+jWzAQlITmz8aLYWjGTj tWju1E6cR5QVqdOaOE9ZVDXhJLWk8+mDsKZcOvQXFSptD4X4DqAfxShKKg/we5x//T hPdTa77wuHEPnZjLiUxqBabuq17mLTpru4nIbD20= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 678E9F800AB; Fri, 7 Aug 2020 18:13:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 292A1F80218; Fri, 7 Aug 2020 18:13:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 94C1CF800AB for ; Fri, 7 Aug 2020 18:13:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 94C1CF800AB IronPort-SDR: h7h4wSgHR8RmhffQSUhelA+G8u4IkzETpViaVHLKw43jQcY08H9F/1dwd5Mm2gr29tZvw9K03J PkBsBKAv/8Nw== X-IronPort-AV: E=McAfee;i="6000,8403,9706"; a="140998578" X-IronPort-AV: E=Sophos;i="5.75,446,1589266800"; d="scan'208";a="140998578" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2020 09:12:36 -0700 IronPort-SDR: OlBg9zGVni4/9KCuF1bpKjkpngtbcWbWC/GtoRwEMSUgIIeX0q5vEWwCMQQ/Fs1DmmoCLwO5Yf HhTUtE3ItwyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,446,1589266800"; d="scan'208";a="276710129" Received: from linux.intel.com ([10.54.29.200]) by fmsmga008.fm.intel.com with ESMTP; 07 Aug 2020 09:12:36 -0700 Received: from [10.213.30.220] (mrajwa-mobl1.ger.corp.intel.com [10.213.30.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 8583058066D; Fri, 7 Aug 2020 09:12:35 -0700 (PDT) Subject: [PATCH] Aplay: pcm_read(): return read samples instead of requested upon abort References: To: alsa-devel@alsa-project.org From: "Rajwa, Marcin" X-Forwarded-Message-Id: Message-ID: <67dc575e-0309-e087-92d2-a468684be5fd@linux.intel.com> Date: Fri, 7 Aug 2020 18:12:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Cc: broonie@kernel.org, pierre-louis.bossart@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 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();