Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80783C433DF for ; Fri, 9 Oct 2020 15:11:11 +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 4EC1122276 for ; Fri, 9 Oct 2020 15:11:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="iHcjVkyN"; dkim=pass (2048-bit key) header.d=axis.com header.i=@axis.com header.b="GiQkKPAh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EC1122276 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=axis.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 A2E8215DC; Fri, 9 Oct 2020 17:10:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A2E8215DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1602256268; bh=JB8o6dJV7z2WOAYTovRLJmJppAwil/0YbrK6Ktibkm8=; h=Subject:To:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iHcjVkyNVN7mKy6TzzCpG95oF0L+YZQyoP7sZ9kmznjJr3ojpKzyuY4xeNmQGESqD lBKOe1qVR7B7Gvd7G6IVH0v39N780L/7hbYBlN7bL0qs1bdPgyNiYEOyfwU8hGBGfJ kxzvbauao2vJZjPoygw+uaU61RYmXI/tZ51QAjnE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 26DEEF8014D; Fri, 9 Oct 2020 17:10:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 90566F8015B; Fri, 9 Oct 2020 17:10:16 +0200 (CEST) Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) (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 6F50BF80128 for ; Fri, 9 Oct 2020 17:10:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F50BF80128 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=axis.com header.i=@axis.com header.b="GiQkKPAh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; l=1621; q=dns/txt; s=axis-central1; t=1602256214; x=1633792214; h=subject:to:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding; bh=ORzkGxePo6tbvhRNduvHCycFbx21mIKX9EB04COaAps=; b=GiQkKPAh2yiz47alb7w80kJKsMrzugWg0KaOI+abC9TttbiBgPKW7zWy PvLc+SL1cj2dURs0ZBI91csGlUBbaTUEo84C6HE9wuyNKVlhHU6YtMaHx BxCBfIVz8jXtheidc1VX6uDHClIOvjM4Fq1iIchwCUwmm3tI4VJupwyfX H1SnHFqxEtGQ7xTqGzhWrSfZY3wOR27NJ8khd5Z3nWs+C9nKFiJxMlRx8 ZTOdseAYG1CLlTRk/BgW6jvrwbdtH05LZ/NlO6oniueKtW5piiGFTiinW R5lY/DvqRVOzPL77z7KULSmDXLEo3CuEh6n5F8TqQXG7SbXslespNebzY A==; IronPort-SDR: P4jFYFsSzQ7+kqhfy1hYhzZX5FSSUbb6LtDOqfPGTyrfWGdu9ktVPD7PrY5gS2Q6Zu0PV0AkyD UZVKskrSG2ZZ/YGcK7OGASARRcTRv0MZawP58YlNneHV8BzGVCeuikWfBmFRz4z9KebFKXDxmQ tfJw2G391sqRMIp9Q4Ly35nYQRJAYhU5zsSt/FQ17L58qSdXa8ldcFzyrzijENlP2J/lZNftIn G2H6+7/LbW4q26XfFogFW48VVuUfmbCXKa9n1W5AYOEvM+H5e36WsitarasH4GN964IJOC0t5X w/Q= X-IronPort-AV: E=Sophos;i="5.77,355,1596492000"; d="scan'208";a="13348599" Subject: Re: snd_pcm_status() does not update status->avail To: Jaroslav Kysela , Jonas Holmberg , "alsa-devel@alsa-project.org" , "tiwai@suse.de" References: <2d4ca02d-8be3-62ca-c273-f5b277e64158@perex.cz> From: Jonas Holmberg Message-ID: Date: Fri, 9 Oct 2020 17:10:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <2d4ca02d-8be3-62ca-c273-f5b277e64158@perex.cz> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 2020-10-09 16:30, Jaroslav Kysela wrote: > It seems that nobody is using those status fields. Usually, > snd_pcm_avail_update() is used by apps. Anyway, this should be fixed for > both > directions. The avail should be probably synced to > snd_pcm_plugin_avail_update() output: > > > diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c > index ea60eb98..5739cfc2 100644 > --- a/src/pcm/pcm_plugin.c > +++ b/src/pcm/pcm_plugin.c > @@ -541,16 +541,20 @@ static snd_pcm_sframes_t > snd_pcm_plugin_avail_update(snd_pcm_t *pcm) >  static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * > status) >  { >         snd_pcm_plugin_t *plugin = pcm->private_data; > -       snd_pcm_sframes_t err; > +       snd_pcm_sframes_t err, avail; > >         /* sync with the latest hw and appl ptrs */ > -       snd_pcm_plugin_avail_update(pcm); > +       avail = snd_pcm_plugin_avail_update(pcm); > +       if (avail < 0) > +               return avail; > >         err = snd_pcm_status(plugin->gen.slave, status); >         if (err < 0) >                 return err; >         status->appl_ptr = *pcm->appl.ptr; >         status->hw_ptr = *pcm->hw.ptr; > +       status->avail = avail; > +       status->delay = snd_pcm_mmap_delay(pcm); >         return 0; >  } > >                                         Jaroslav > I have tested your patch and it solves my problem. Are you going to push it? Thanks! /Jonas