From patchwork Tue Aug 21 19:46:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Biehl Pasquali X-Patchwork-Id: 10572323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE42C109C for ; Tue, 21 Aug 2018 19:47:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF31221FAD for ; Tue, 21 Aug 2018 19:47:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2C1C28EA0; Tue, 21 Aug 2018 19:47:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF1F21FAD for ; Tue, 21 Aug 2018 19:46:59 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 95B7E26766C; Tue, 21 Aug 2018 21:46:57 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9CDA926766E; Tue, 21 Aug 2018 21:46:54 +0200 (CEST) Received: from mail-qt0-f177.google.com (mail-qt0-f177.google.com [209.85.216.177]) by alsa0.perex.cz (Postfix) with ESMTP id 30F81267657 for ; Tue, 21 Aug 2018 21:46:51 +0200 (CEST) Received: by mail-qt0-f177.google.com with SMTP id f18-v6so21679049qtp.10 for ; Tue, 21 Aug 2018 12:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=5V9I6AMdILq1koJXC3vOOMiaD5pBRyF2lHByvjHfQ6k=; b=L3acZKsrAekoRGB3oKUa1fSJsPhCmjp+XVcnnEoAkBaQVy/augaIP7iLlNalth7WbR 6mtsi597zbLYRuJXwxi+GUxvQw8LL84xUaNnqx6r2N0cFp3rb8CT6aN9MFez3ZaWusUS FneXnJ7IRf+4NAR1JeH55sE5F6iAB0gZx7yzixgZZLoRXtpcnwhJyF/2NizgEkFKeGTR prA995bRQ0ctl7pUVMdkSwQwMhsvc/bopPJOfuRoR8kIL8qEyehPkKiMsp8cJCfMUUQh g0BviUjlCGJ27ebyAGGnJ5F0+hMdymwRrUkI7XqNzDUdKbCMIVEvK/27WJjvooPTx0hT X+zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=5V9I6AMdILq1koJXC3vOOMiaD5pBRyF2lHByvjHfQ6k=; b=Gus93J6AsikdCPV9inKoqxjRL+YBtUSWwzBg6/bGXMVZrJYtCZemfUMbyNxRGBVSsO P0QAOiuoLY4w4191eezBRsKom+m/byyRNBYDFtm9zocBEKNZ3sfc6MrZzBS8fFkUCvMY JyiCDub8OI/lauCO8YA4a0eZam9O1fo/CwBrGSe+vdRw2qzX9p8gvxNcrdZH//NiDSkV NUJPRqSDa6/dvdeNICntXvkBwOSulSaloASDd4rDsah3mSbYf5mLkA0ETykR8avSqPUb XUxNUVa/3rh3Y+blidPKKNh22tqjIhFZ/RoQPOirk6uOx3/ddWT4Lvcx41FHLHF/Sh3X eUFA== X-Gm-Message-State: AOUpUlGlVdpSUCQ1bTfTIxoxFAi/l0I8GV28Wus77jsZKcgoxYavNlf9 hoJHQ0SxrpQPk3IsUx6Rjf+1tMM4 X-Google-Smtp-Source: AA+uWPxf2W08cbsJbTtk3Jfaf4B1/Y2SqjYwB6z/ggYNAEPiO6ez3jVwM9LyTL+xLq6v1egaNLb00g== X-Received: by 2002:a0c:d90a:: with SMTP id p10-v6mr47540979qvj.171.1534880810123; Tue, 21 Aug 2018 12:46:50 -0700 (PDT) Received: from localhost.localdomain ([201.37.66.59]) by smtp.gmail.com with ESMTPSA id d138-v6sm4720544qke.18.2018.08.21.12.46.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Aug 2018 12:46:49 -0700 (PDT) Date: Tue, 21 Aug 2018 16:46:43 -0300 From: Ricardo Biehl Pasquali To: alsa-devel@alsa-project.org Message-ID: <20180821194643.GA10347@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Subject: [alsa-devel] [PATCH] ALSA: pcm: Return 0 when size < start_threshold in capture X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP In __snd_pcm_lib_xfer(), when capture, if state is PREPARED and size is less than start_threshold nothing can be done. As there is no error, 0 is returned. Am I missing something? Cheers! pasquali --- pcm_lib.c.orig 2018-08-21 15:31:54.457405053 -0300 +++ pcm_lib.c 2018-08-21 15:56:01.264549084 -0300 @@ -2125,7 +2125,7 @@ pcm_transfer_f transfer; bool nonblock; bool is_playback; - int err; + int err = 0; err = pcm_sanity_check(substream); if (err < 0) @@ -2173,11 +2173,15 @@ goto _end_unlock; if (!is_playback && - runtime->status->state == SNDRV_PCM_STATE_PREPARED && - size >= runtime->start_threshold) { - err = snd_pcm_start(substream); - if (err < 0) + runtime->status->state == SNDRV_PCM_STATE_PREPARED) { + if (size >= runtime->start_threshold) { + err = snd_pcm_start(substream); + if (err < 0) + goto _end_unlock; + } else { + /* nothing to do */ goto _end_unlock; + } } runtime->twake = runtime->control->avail_min ? : 1;