From patchwork Mon Jun 22 13:15:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617699 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 3A37A13A0 for ; Mon, 22 Jun 2020 13:20:19 +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 B6221206EB for ; Mon, 22 Jun 2020 13:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="CI6oO001"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="FglQj2Nu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6221206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 4953B16D6; Mon, 22 Jun 2020 15:19:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4953B16D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592832017; bh=LHZ0tA8UNHuJFyKfvqyo+ofVZWN9X7ggyGU2y1i9WKw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CI6oO001gKneVq+PY8WuecSjkt0weaW9CJCJSRy6VVVckwt3/GazwP6ivAkrw605A JqBj/ztPvNUWzRr0YO9EVMuR58krUSTGQsvB4LwHIU6SfOTGx8EWcq2SEbdw7opFd8 asvr5/jiZ9N2uBWf4eiKdiG7cC+tuUNCMoUp5S60= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32600F801F2; Mon, 22 Jun 2020 15:16: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 140D2F802F8; Mon, 22 Jun 2020 15:16:15 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 A13FAF8015A for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A13FAF8015A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="FglQj2Nu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=K7i/GaZFHcvhTiY7K+bVMkKcwiS3a1ggjaJlZurhtOs=; b=FglQj2NuzOfINuReyh81RJORWy l30RL250yEDDTCRN1SBrsp9bgRsaTLGSUNE9yta7Sy3p6zcdU+0Se3lfKFWmzUuc6DddE3QRLOl0Z ZbzxgohDIvQ3M8LayVeHHxlndgWiK1kbKKvr9Pa+fiZavr+fUxdQBw9H8NLrQ0B4WrsVUx21Rg3jC rff8OAqg14qwozdUMNkZuYgqB6k+l0yW4uVT8f+dNJEFYVMnVppNzdqaOjtpvO6j+Ujqw1NOz/2Vl 5qtN8WBHLtMvrQpQ4jpgBDrWQDAUsgyqbns90T9GVwyBX0oQsXK2M6cNhgDVnM61E+jpaabzP8tI0 vipkXoYQ==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwI-FB; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00065q-3S; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 1/9] control: Fix typos in the namehint example Date: Mon, 22 Jun 2020 14:15:07 +0100 Message-Id: <20200622131515.23385-1-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" Ths "namehint" is a list, and there doesn't seem to have been any history where the separator would be a colon. Signed-off-by: Mark Hills --- src/control/namehint.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/control/namehint.c b/src/control/namehint.c index ecd470f3..d81d3a7e 100644 --- a/src/control/namehint.c +++ b/src/control/namehint.c @@ -543,10 +543,10 @@ static int add_software_devices(snd_config_t *config, snd_config_t *rw_config, * User-defined hints are gathered from namehint.IFACE tree like: * * - * namehint.pcm {
+ * namehint.pcm [
* myfile "file:FILE=/tmp/soundwave.raw|Save sound output to /tmp/soundwave.raw"
- * myplug "plug:front:Do all conversions for front speakers"
- * } + * myplug "plug:front|Do all conversions for front speakers"
+ * ] *
* * Note: The device description is separated with '|' char. From patchwork Mon Jun 22 13:15:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617691 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 C3696618 for ; Mon, 22 Jun 2020 13:18:33 +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 59F8220739 for ; Mon, 22 Jun 2020 13:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="rRKtr7MU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="e2Tjt3gl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59F8220739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 DF4A516AA; Mon, 22 Jun 2020 15:17:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DF4A516AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831912; bh=1Y4/67d0NLl7+EZBvJVn3CAsDOhqAtvYelMBFg9kpPE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rRKtr7MUhiAk18DifW0WpR2PACrpx4XQpXT49+kTc6IxyJ5SktVmnaQeGm3W0vcFz +ESGiCjoFElrh0cz4MKQ164xxVQmpvLaOond+tqgr2IJGoxHbgs7TCmSj/ps8NNNcg 9lGQzw2puHNMvtEX0Xsid3LMneVKPoj2qVUgwNoU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 64F68F801DB; Mon, 22 Jun 2020 15:15:36 +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 9638FF802A2; Mon, 22 Jun 2020 15:15:29 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 AFC43F801DB for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AFC43F801DB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="e2Tjt3gl" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=G2ZSecEV9yRIX2+CzLsc2Yn8PQgso1L4Xx3ldhEqeX0=; b=e2Tjt3glcAer9B+xpOW/khpGPg TGK3E8JxXYWSOuufwnPRmgN2mCPJOOUe4aGXIdg4vtYqKBAw1EUDlO8W2+MX0ZnYmBLHF/Gi/UJhC 6VZqHtDeozdp1V2+aAah8bFTbzeZd6ADkzR/SLZXBYVcM91v1hmy9Gg677XBxdgZ/eK1JYvt2uSgM epDD12kGje27AmAfeu2oboM8skLUG1VSUmGWq49sGJWo6iO5yuTbphhn6ETWpz6e9IT33glOnhqmT d44giXGgTBAQo8/Hbs1U4bB6ow/QDW3ix5Wv5uao7UZgrwAxDxo+V2dvSVkMXs7SPwk7FrCCOeeiQ K7x509Eg==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwJ-Ez; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00065t-3l; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 2/9] control: Fix a bug that prevented namehint behaviour Date: Mon, 22 Jun 2020 14:15:08 +0100 Message-Id: <20200622131515.23385-2-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" Looks like the documented behaviour was broken in commit 1ba513f9 in 2006, with the introduction of multiple fields. I've chosen to match the described behaviour. Prior to this patch, using namehint could be made to work by exploiting the lack of escaping of the "name", populating the other fields: "plug:front|DESCDo all conversions for front speakers" rather than that which is documented and presumed to be the intention for asoundrc files: "plug:front|Do all conversions for front speakers" Everything seems to strongly suggest nobody is using this feature; I can find no working examples through a web search and probably someone would have hit this bug. It's not documented in configuration, only in the snd_device_name_hint() call. So it would probably clutter things to provide compatibility for the old behaviour. I have found it to be very useful since working in Chromium, where it is the only way to expose chosen ALSA devices to web applications. A temporary buffer is required to null-terminate the string. I see no use of alloca() in the code, presumably to avoid unbounded stack size. So memory is allocated on the heap. Signed-off-by: Mark Hills --- src/control/namehint.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/control/namehint.c b/src/control/namehint.c index d81d3a7e..e4f696ad 100644 --- a/src/control/namehint.c +++ b/src/control/namehint.c @@ -78,6 +78,31 @@ static int hint_list_add(struct hint_list *list, return 0; } +/** + * Add a namehint from string given in a user configuration file + */ +static int hint_list_add_custom(struct hint_list *list, + const char *entry) +{ + int err; + const char *sep; + char *name; + + assert(entry); + + sep = strchr(entry, '|'); + if (sep == NULL) + return hint_list_add(list, entry, NULL); + + name = strndup(entry, sep - entry); + if (name == NULL) + return -ENOMEM; + + err = hint_list_add(list, name, sep + 1); + free(name); + return err; +} + static void zero_handler(const char *file ATTRIBUTE_UNUSED, int line ATTRIBUTE_UNUSED, const char *function ATTRIBUTE_UNUSED, @@ -626,7 +651,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) if (snd_config_get_string(snd_config_iterator_entry(i), &str) < 0) continue; - err = hint_list_add(&list, str, NULL); + err = hint_list_add_custom(&list, str); if (err < 0) goto __error; } From patchwork Mon Jun 22 13:15:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617689 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 6A21413A0 for ; Mon, 22 Jun 2020 13:17:57 +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 B0E2E2068F for ; Mon, 22 Jun 2020 13:17:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="SJWCZLTP"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="gUwWQ+wo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0E2E2068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 4C18516D3; Mon, 22 Jun 2020 15:17:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4C18516D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831875; bh=IDR7gxUCOvISnhdQcpd8cEMUtddSE7iNrTcfIY4h0Qo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SJWCZLTPhZ1W+I5R34fgsmdEm/PNs/1U86YAbp/eRJTIVZuFwI6rojdVMl//0I6VX ua077FvZSXVp9XdZkDKcKCixQKPXklcimuCmjYCXXpLUGznsUNJ2vaIMyO5zd56YJb /l4eHsI/Toc+xPgSpzEh3JVbIn0oAei59GelaNVA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 55425F802A8; Mon, 22 Jun 2020 15:15:35 +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 1F4B7F802A7; Mon, 22 Jun 2020 15:15:29 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 9C782F80157 for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9C782F80157 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="gUwWQ+wo" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=J4SmVEdjlodgHeWKQbht59vRLnVPgyAYhS1qVuU+Wn8=; b=gUwWQ+wojYvf24ZctwC832vNrM xyGXbuYYIpitUSXBNJrlxI4Fbzwb4ckVeFi/zfdbCFCMeW96Y6RW3K0Mnp++DvyKdb2XFmwECy+SA eXnn0lFIzOhfabAtTd28fUhqDj//CYK62E98Poj1cuSLEDWw8GNdPXaPLVXgnyYSdr65nImAPVTF4 4yGkBLixAY+mEyPR63H+MnJC3BvQ+444LGCY4jeyhkxxXPMWSl7JJ731GYqrGqHLxB3VRdHspRGIn B8FD3YZUvVmO7kqf6u96w3cEYNpGjHmrtupE176WLl6GD531ut8mdiYz1K1+L9/QVcdylUeyIf3w8 aGYHh2ow==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwK-Ga; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00065y-44; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 3/9] conf: Read a host-specific asoundrc Date: Mon, 22 Jun 2020 14:15:09 +0100 Message-Id: <20200622131515.23385-3-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" On systems with a network mounted home directory this is thoroughly useful to allow for a core set of asoundrc settings, but with different settings on different hosts. It's not possibly to implement this in our own asoundrc or local customisation, as it's too late. The installation file must be modified. This is similar to ~/.Xdefaults-* on some systems. Signed-off-by: Mark Hills --- src/conf/alsa.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/conf/alsa.conf b/src/conf/alsa.conf index 18427ec6..4dae0e9c 100644 --- a/src/conf/alsa.conf +++ b/src/conf/alsa.conf @@ -24,6 +24,17 @@ "/alsa/asoundrc" ] } + { + @func concat + strings [ + "~/.asoundrc-" + { + @func getenv + vars [ HOSTNAME ] + default "localhost" + } + ] + } ] errors false } From patchwork Mon Jun 22 13:15:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617707 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 EB23813A0 for ; Mon, 22 Jun 2020 13:21:18 +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 80DC62068F for ; Mon, 22 Jun 2020 13:21:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="aRXHDYJm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="xJRWm/W9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80DC62068F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 164D016DE; Mon, 22 Jun 2020 15:20:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 164D016DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592832077; bh=l1gZqnBDPEgRgG6VPKUlnuRh8mioWgeTUdgREpPEXQk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aRXHDYJmQwm4BOZgBTAJ0N/n/cu1o7yc4Gv5+GIjRYWmJEYfCUatsUIb5xJa7Vmia 1Yv6gyqgo/8RJEpzmdkDD6o3STAKjIXG2fu5ZNf3L+WlLzyMrKTwjCnUZrrrOTDSCf HiDNpEobTszk6Jvlnr9dZJ/3bv/y50aii77OVYj0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A71E3F802F8; Mon, 22 Jun 2020 15:16:21 +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 21999F802A0; Mon, 22 Jun 2020 15:16:15 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 7B3CBF802A0 for ; Mon, 22 Jun 2020 15:15:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7B3CBF802A0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="xJRWm/W9" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mgHkLLSwxX2bsoTwh7T6kbqlwvmX5Q6zaDcW8z23lxw=; b=xJRWm/W909aqO0OIQoDqSGhNsx 54Bi4Q6A4QjFLbe8mOndqv5Xxy/JNe37CDn+zNheYXBkM1edSO1DJVbfg3uxpKCBl7n1o650EbksI ahDqimBuQa3z2NFw9WuAF7tzpDNWao9zjOvTrGrFqiqBJDeZU6qPXSCmVvdSwGe4eVZB72rJtWHLU 8of+0UAKpZgUbn6++OvYbqMTFY6y1UWxn66PGee8FhT1DO7/daQluF4aZA/7eP0aQhXhs5nHyxFow 9Vt8QvkOG5N2oiFTajghb07Qo7DmHn1xHkuHBRJzYHbjbLpATUNTu/EOha6qSWFNkq47eWUR+mPEj 5pYR45Tw==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwL-HL; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-000663-4y; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 4/9] dsnoop: The delay presented to snd_pcm_status_delay() was incorrect Date: Mon, 22 Jun 2020 14:15:10 +0100 Message-Id: <20200622131515.23385-4-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" This was the original bug that caused me to start looking at the ring buffer functions. In the API this is documented as: "Delay is distance between current application frame position and sound frame position. It's positive and less than buffer size in normal situation, negative on playback underrun and greater than buffer size on capture overrun. " Because dsnoop was returning the buffer space available to the hardware the return value was always quite large, and moved in the wrong direction. With this patch, dsnoop now gives results which are comparable to using the "hw" device directly. My test case was with snd-echo3g (Layla3G). Signed-off-by: Mark Hills --- src/pcm/pcm_local.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 89d4125b..1fa8e61d 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -589,7 +589,7 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_playback_delay(snd_pcm_t *pcm) static inline snd_pcm_uframes_t snd_pcm_mmap_capture_delay(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_hw_avail(pcm); + return snd_pcm_mmap_capture_avail(pcm); } static inline snd_pcm_sframes_t snd_pcm_mmap_delay(snd_pcm_t *pcm) From patchwork Mon Jun 22 13:15:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617695 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 6150A618 for ; Mon, 22 Jun 2020 13:19:36 +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 ECC11207BC for ; Mon, 22 Jun 2020 13:19:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Gr7M8v4I"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="tG2MOl6i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECC11207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 5724216B0; Mon, 22 Jun 2020 15:18:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5724216B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831974; bh=wHyx1TGVP38dUWoAxHZ+sQRhm7kAYBZ2n11ZYYM8jO0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Gr7M8v4IZOl94P/s1YUp5p700nig0ji34bvdAfuuyuIQl07V8XBIqDM4q8hqZnYVY Lhg5jbKYn2Pb66bh0c5Y28XJ0y6WlG2kfarG0FcMOPR8l/zgqRvobtE4hk1UDgs05l I2+VfaM1vmGgC9RD7n8OEPY5g29TP2vyWvNRxBaE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 429B1F802DF; Mon, 22 Jun 2020 15:16:03 +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 31658F802A9; Mon, 22 Jun 2020 15:15:35 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 B24DDF80246 for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B24DDF80246 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="tG2MOl6i" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=FqFcdVXAN5JBUgEknrPa10Y/3ae8nehSFUXYLeq6PEI=; b=tG2MOl6ideoIfUem/7r4VJx1je H7kRvrIw7ED4m4VBYN85TZQo+P0mxE52boz84cKVb1BrB90DRKUB+6WLuXvVUi2ZkvfmVut2+rRk2 ABz7Bg2qaM1gTJE4Lvjv15V8zl0hRAcxsZONz3dMlPPGNTLkdNFnYw5giC8dBIvzs3F15zApUXPEC RY8yKWUudWndUVZ9hasIIylidj3u/2OiReWicy6vJR7+ezB9TlJ5N6S7zhvuHml1SiScFRDspm1sy lKN+DOrjFepyoWoUqoMUOuY9rcIMCoaqtcTNoDaGn8jWpiPsk9KWP36nhWnL2hLfoD1wp5S8vTIAt LYcqSuVQ==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwM-Hy; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-000668-5V; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 5/9] pcm: Annotate the _delay functions based on findings from the previous bug Date: Mon, 22 Jun 2020 14:15:11 +0100 Message-Id: <20200622131515.23385-5-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" Signed-off-by: Mark Hills --- src/pcm/pcm_local.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 1fa8e61d..cf018fc0 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -582,11 +582,17 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm) return *pcm->hw.ptr % pcm->buffer_size; } +/* + * \retval number of frames pending from application to hardware + */ static inline snd_pcm_uframes_t snd_pcm_mmap_playback_delay(snd_pcm_t *pcm) { return snd_pcm_mmap_playback_hw_avail(pcm); } +/* + * \retval number of frames pending from hardware to application + */ static inline snd_pcm_uframes_t snd_pcm_mmap_capture_delay(snd_pcm_t *pcm) { return snd_pcm_mmap_capture_avail(pcm); From patchwork Mon Jun 22 13:15:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617693 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 DDDBD13A0 for ; Mon, 22 Jun 2020 13:18:49 +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 6B41820716 for ; Mon, 22 Jun 2020 13:18:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="OZN8p3IF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="v8183TzI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B41820716 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 07A3D16D6; Mon, 22 Jun 2020 15:18:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 07A3D16D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831928; bh=dvQIQwPtrE3Is3/5G1/W0lX7v95Je2Mj0rKDOyj4g7c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OZN8p3IF5MRBbxAVZnKh2Mjm/5qHZnGMZ2JcFFYU0LvnBeHRNa/3HjGqzdF5z34EG gizTmdRtNQv9PQRPR9NCLf0o21c0KzSoCwlAN94iHxiAVDjBExCTP2kaKgdgaGyNZE MdqsWHSMm829FQnIpLvdE9CX0SR0eLhQlM8u7Scs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0895AF802D2; Mon, 22 Jun 2020 15:16:02 +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 7F0C4F801DB; Mon, 22 Jun 2020 15:15:35 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 A7990F80162 for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7990F80162 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="v8183TzI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=KjxRTpjsOx14lhh+BLgwsTDvD1d6N5d26/Jt4B88mgw=; b=v8183TzIPBjsZTgaF8sMW6PLMI JviwD8DmQbn/loz68WZa6v20bMQOUVLMBfg1Vl2+YW1lUrLNw8n2zUpyHJvGZgFWBAlH5hVeqCJ3W ZO4TOgRY3pHR+Qglbu8FJBcm6zmTvrMZhVFcaS6ff/roKDTOwcjqPUh9KUzUTvADIaF0BmttZ5/AC +uuaJvdFRUdNzepWS8/LZBAfTwKelRdhBFOGFUrOXkM1bPbx+SpMtwe/DBB63xQDq+F87RCJmyPs+ f+ikVAu/3bb8iuuplMZeO5Pr6ILHcNWDEGzlxI9dr8MQ0oASmW1wWD2TUspk9ITAeL6FU3PL/HZnZ 0ts8fNXQ==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwN-IM; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00066D-5s; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 6/9] dsnoop: The stop threshold was not implemented correctly Date: Mon, 22 Jun 2020 14:15:12 +0100 Message-Id: <20200622131515.23385-6-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" The previous implementation would mean that stop_threshold behaved erratically. The intent is to detect that the buffer is too full, and stop. In practice, I don't think this was a bug in practice for applications which don't adjust the stop_threshold. The line above catches those cases. Signed-off-by: Mark Hills --- src/pcm/pcm_dsnoop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index c64df381..790d944c 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -165,7 +165,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm) // printf("sync ptr diff = %li\n", diff); if (pcm->stop_threshold >= pcm->boundary) /* don't care */ return 0; - if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) { + if ((avail = snd_pcm_mmap_capture_avail(pcm)) >= pcm->stop_threshold) { gettimestamp(&dsnoop->trigger_tstamp, pcm->tstamp_type); dsnoop->state = SND_PCM_STATE_XRUN; dsnoop->avail_max = avail; From patchwork Mon Jun 22 13:15:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617701 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 0706513A0 for ; Mon, 22 Jun 2020 13:20:42 +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 8DE08207BC for ; Mon, 22 Jun 2020 13:20:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="i2fBzFmx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="sviGoMOM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DE08207BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 0717F1676; Mon, 22 Jun 2020 15:19:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0717F1676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592832040; bh=5DUZPgwn/zwalRpur+X/AsGfwRNlBanJL2WtFf/8TYs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=i2fBzFmx2d7PzAd/wD2n+6KHa+hcxd0ywkAj9P2wwWJysq3PYD1wtwh6R0EuW6L1K vbw/iVVd+REF5WOBEJZ4L/7EwFFs2p94Bah1K7lFDQI2zXi6byPtbTTPjXL4l4NFCR qfLJe3DU0vjdTApp/RVbSfpxe8W5UVH3XqQFNYos= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 841CBF802EC; Mon, 22 Jun 2020 15:16:20 +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 17832F8015A; Mon, 22 Jun 2020 15:16:15 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 8C71AF801F2 for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8C71AF801F2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="sviGoMOM" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8cU1UkvPEE3dgwW86w1iNdExXcQr4WWcypzmRmDBv5Q=; b=sviGoMOMegrdJ7ZQeI5lxm0gBE BwxBgKcRPXKxyZy25cOFKNXhLS8WvROI9QaQraJQKg0VPg/gBGumstQbSSt3Z1ueSfYhSst51m9Lw hZdoWWasM2FuxkoHrBy8pMEcxS4T0p14r5etVdgcgcVtkElBFryWyIJvUPWj6mOcI9zBZRx1z9Cmk xT5Bf2Poo5vC7egrL9dX/5wm85SkgTZhtkUR7taVpSWqEWBTomILIlchgO3l2We1YDLK7XI4rpF78 x/AlrBSku26Dp5sKKcRwAkCZAl7Fv7TipjWl1kKQEdONW6CYDy1pBTpcC490gcIRkMzG4LLFqoMhO lM/dhPvA==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwO-IC; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00066I-6K; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 7/9] dsnoop: Another bug where the empty, not full, part of the ringbuffer was observed Date: Mon, 22 Jun 2020 14:15:13 +0100 Message-Id: <20200622131515.23385-7-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" This looks like a simple mistake dating back to 2003 (commit 7470a5b9) where code originated from dmix. Signed-off-by: Mark Hills --- src/pcm/pcm_dsnoop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 790d944c..3588eb91 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -241,7 +241,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) /* Fall through */ case SNDRV_PCM_STATE_PREPARED: case SNDRV_PCM_STATE_SUSPENDED: - *delayp = snd_pcm_mmap_capture_hw_avail(pcm); + *delayp = snd_pcm_mmap_capture_avail(pcm); return 0; case SNDRV_PCM_STATE_XRUN: return -EPIPE; From patchwork Mon Jun 22 13:15:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617687 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 0199D618 for ; Mon, 22 Jun 2020 13:17:09 +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 8DE972076A for ; Mon, 22 Jun 2020 13:17:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Ovll0ZJD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="0WDHvl7W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DE972076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 1123416B4; Mon, 22 Jun 2020 15:16:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1123416B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831827; bh=7rCpMp9Rp+FqySWIb7GWHLRiPGRWfT1zUsHrHxzex4U=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ovll0ZJDtaw6BQCE+jVZ8vhWh/m+kLhLIYGWFf2uxOHEZR5zCdb6lv+EJxTqMVBQ1 tbe948yb9E+8kExXNfkg+aj3ptWZcAw/PYgaI0auSwpiidsLi36yPDP26vlHQwPzFh jOFd+py2RWOUUiiYkqBN1tKuqzsC3sZ9A2SO9lmY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7D18CF80157; Mon, 22 Jun 2020 15:15:34 +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 2DD04F802A2; Mon, 22 Jun 2020 15:15:24 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 A4538F8015B for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A4538F8015B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="0WDHvl7W" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=vEejpRzBFTJ0ZNMAC69VSODSqA0qVvaW7DAqw5N5mBo=; b=0WDHvl7Wt5BXpFAgIcG6+ENy3r UMvtFXYBv1EkkBwUfa0N9i0pSU7Lv2h/nfmwHdmy+Vbs/AmHxDoZp0a4XWsh9y7089LNC1fojqSL7 Ity7/g9R7uShg7iLXl3ku2w2H5n9wqJk79itGNzNa1UDSr1KElYqR+KLxTI7d65Z+QXQfGf5+VRLe p9HNzFJl52KMSa3+D296p0+AxoLG7aiAzIN1vKVVmDEdrWYIs2WcMzCKQQwF8EXf4FXjjBlV/jVl/ 6M4IUw2XuZqEgRnq72kbzu36Wi33K2uB2PA7madjWLG8UpjvcpS3nFr3vow31DcP51qGaloVJMDTs LG8U+BsA==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwP-GW; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00066N-6h; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 8/9] dsnoop: Make use of the (previously unused) function Date: Mon, 22 Jun 2020 14:15:14 +0100 Message-Id: <20200622131515.23385-8-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" Match the equivalent funciton for playback. This is on the assumption that values should be capped at zero, which is what _rewindable() implements. Signed-off-by: Mark Hills --- src/pcm/pcm_dsnoop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 3588eb91..7904314c 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -352,7 +352,7 @@ static int snd_pcm_dsnoop_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTR static snd_pcm_sframes_t snd_pcm_dsnoop_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_hw_avail(pcm); + return snd_pcm_mmap_capture_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) From patchwork Mon Jun 22 13:15:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hills X-Patchwork-Id: 11617683 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 90C01618 for ; Mon, 22 Jun 2020 13:16:16 +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 1C5DC206D7 for ; Mon, 22 Jun 2020 13:16:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="kZFCWuid"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="TD0ucgs0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C5DC206D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xwax.org 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 610A316AF; Mon, 22 Jun 2020 15:15:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 610A316AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592831774; bh=mWeTDIW67t9jYdpSIhRDV4omjfnAqJZRqUvpLi9jfRA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kZFCWuidaNzDdqzGbh7c8D81NPvztvcSttX5LV3vnT6J2QcXrkQ6J45PVSocZG0ST gHGRRFR3/pu8h4fnqDtgJA0BLc4rPr/E0kMk/FAOmVYUKT+hJHOmwACPlU1LnYVI63 zFJM71565K9LF1IvgioQ5616P8OGZBoVSfdAuOww= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C34CAF8010E; Mon, 22 Jun 2020 15:15:25 +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 CD66FF8028A; Mon, 22 Jun 2020 15:15:23 +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=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from jazz.pogo.org.uk (jazz.pogo.org.uk [213.138.114.167]) (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 AB059F8010E for ; Mon, 22 Jun 2020 15:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AB059F8010E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=pogo.org.uk header.i=@pogo.org.uk header.b="TD0ucgs0" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pogo.org.uk ; s=a; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=uz8hBjt0fgzGPTxt0+OXhBQqBiZWLMciY724Z+W+uw8=; b=TD0ucgs0xMkNj6PMpXHwF/3RID YYd50xMS0CIsNCJB+37oUGgS8MjblTL/cz69dG/IhO0GeSsG3YzaTWQ3y1RO3HHZ/T9OFjXkTMyxF 6K0B9nMNl3LJK2Wn1krLScM7Kx7qSQPrScnub40osv2NEYiYm+aKM8tkcKnSAb4jPCf2yvpmO3kLC m7QRUwZpHwpgTyGSAxCzxEoGKvwsckKk70Xrwads8qZZo3bh/EBb+tmYhn5Mjz0szUSQFiUOdp5dF bC0eN8sYdGeVAwBLDPtASNQGTVJ4GZb41pzVAd1ZDykDidOiGLwJa2J6hXqebO7pnh4K/MGa/6AWF WqeSyByQ==; Received: from cpc1-hari17-2-0-cust102.20-2.cable.virginm.net ([86.18.4.103] helo=stax.localdomain) by jazz.pogo.org.uk with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1jnMI7-000BwQ-QB; Mon, 22 Jun 2020 14:15:15 +0100 Received: from mark by stax.localdomain with local (Exim 4.84) (envelope-from ) id 1jnMI7-00066S-74; Mon, 22 Jun 2020 14:15:15 +0100 From: Mark Hills To: Jaroslav Kysela Subject: [PATCH 9/9] pcm: Annotate the _avail functions Date: Mon, 22 Jun 2020 14:15:15 +0100 Message-Id: <20200622131515.23385-9-mark@xwax.org> X-Mailer: git-send-email 2.17.5 In-Reply-To: <2006221356390.20421@stax.localdomain> References: <2006221356390.20421@stax.localdomain> Cc: alsa-devel@alsa-project.org 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" I took time to understand these functions in the context of the rest of the code, which would have been a lot quicker with a comment like this. Signed-off-by: Mark Hills --- src/pcm/pcm_local.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index cf018fc0..aae58ed3 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -480,6 +480,13 @@ static inline int snd_pcm_check_error(snd_pcm_t *pcm, int err) return err; } +/** + * \retval number of frames available to the application for playback + * + * This is how far ahead the hardware position in the ring buffer is, + * compared to the application position. ie. for playback it's the + * number of frames in the empty part of the ring buffer. + */ static inline snd_pcm_uframes_t __snd_pcm_playback_avail(snd_pcm_t *pcm, const snd_pcm_uframes_t hw_ptr, const snd_pcm_uframes_t appl_ptr) @@ -498,6 +505,13 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_playback_avail(snd_pcm_t *pcm) return __snd_pcm_playback_avail(pcm, *pcm->hw.ptr, *pcm->appl.ptr); } +/* + * \retval number of frames available to the application for capture + * + * This is how far ahead the hardware position in the ring buffer is + * compared to the application position. ie. for capture, it's the + * number of frames in the filled part of the ring buffer. + */ static inline snd_pcm_uframes_t __snd_pcm_capture_avail(snd_pcm_t *pcm, const snd_pcm_uframes_t hw_ptr, const snd_pcm_uframes_t appl_ptr) @@ -529,11 +543,21 @@ static inline snd_pcm_uframes_t snd_pcm_mmap_avail(snd_pcm_t *pcm) return __snd_pcm_avail(pcm, *pcm->hw.ptr, *pcm->appl.ptr); } +/* + * \retval number of frames available to the hardware for playback + * + * ie. the filled part of the ring buffer + */ static inline snd_pcm_sframes_t snd_pcm_mmap_playback_hw_avail(snd_pcm_t *pcm) { return pcm->buffer_size - snd_pcm_mmap_playback_avail(pcm); } +/* + * \retval number of frames available to the hardware for capture + * + * ie. the empty part of the ring buffer. + */ static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_avail(snd_pcm_t *pcm) { return pcm->buffer_size - snd_pcm_mmap_capture_avail(pcm);