Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2312156imd; Sun, 28 Oct 2018 07:29:15 -0700 (PDT) X-Google-Smtp-Source: AJdET5crd/kFBMA/rNK7ABqO36SuFbawONZPH23I+MEzf6DiZOlEe8f2ow1jzdXGKweduYl83j2r X-Received: by 2002:a17:902:b7cc:: with SMTP id v12-v6mr10294704plz.278.1540736955688; Sun, 28 Oct 2018 07:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540736955; cv=none; d=google.com; s=arc-20160816; b=Fr+ObiH1qsgG7JZLsbhTRlHr+Iz3Tt0OUJ/dr8fFu60vDi35ME4HQ5E9B9zpAFMH/a X2wgUovouV83GU/kb1bx+jEIyF4npw6O1LyF1XggpbeiLykw+/jy34svGz7Zu//a0m3L GNM3q+bfk9DZupBPKIEbrP2KRUxgYtiVDOPlKENttxqLqyD7ZaMTpj5zjAhK+/DO2NKO kFJY4dfgEOa9qaQNGIOoOGR4j6gU3EqaFf3fB8Gkhotflolb1FxcQRipsdDb7OyouDRp JaOABcv9+3YgoSq+aPu8J71ltodVyj51hWA65xMghMORBfuh8TYG6VzqZNor6UPPF7EP dnqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=cYEYJTF3bXiO00wFkNqTlyaFpmSM92XF7ubJa211Jtw=; b=K1A7nwrZ3Za9W60yz8Uf5VKDeRPWFfvBJ8/ywXFjHSw2V8/CsGJYsQBzQdg2uD3LNS OaY4RQm9uvQ7Y1NjlWFGintMidwnUKbRg7m1B2QgY31kmWDEdjT1dYfxUj7RI6OOH0jm ztYYkm41S8UwzaUVYdKrBYPZ4Wza1J+qE7x+3uYimG0nNsXW0gyKsafk3d7h+pZg+He4 IYRtL15Kiz+MwlpUKI9H8hhxV3AWV7moE8yDzZ0FkSLiIr75zOpEEacA+DK7xSrRQwJd 4dIgK7BoWFD0d+j7tW3MildUYiMCgWIWv/cU1onA/f337oN7TksiCUxe7Kd7JT7Gdx/a 9OuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d124-v6si18090087pfd.93.2018.10.28.07.29.00; Sun, 28 Oct 2018 07:29:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727602AbeJ1XK4 convert rfc822-to-8bit (ORCPT + 99 others); Sun, 28 Oct 2018 19:10:56 -0400 Received: from vie01a-dmta-pe06-1.mx.upcmail.net ([84.116.36.14]:62219 "EHLO vie01a-dmta-pe06-1.mx.upcmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726450AbeJ1XK4 (ORCPT ); Sun, 28 Oct 2018 19:10:56 -0400 Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gGm13-0001bu-0V for linux-kernel@vger.kernel.org; Sun, 28 Oct 2018 15:26:09 +0100 Received: from helix.aillwee.com ([37.228.204.209]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id Gm11gtJgIkosQGm11g9Cde; Sun, 28 Oct 2018 15:26:08 +0100 X-Env-Mailfrom: mikebrady@eircom.net X-Env-Rcptto: linux-kernel@vger.kernel.org X-SourceIP: 37.228.204.209 X-CNFS-Analysis: v=2.3 cv=NNQEBHyg c=1 sm=1 tr=0 a=/+iDkf0alGTUGXENEoGzTg==:117 a=/+iDkf0alGTUGXENEoGzTg==:17 a=IkcTkHD0fZMA:10 a=smKx5t2vBNcA:10 a=3uxiNX8bdHwq9VOc5UcA:9 a=QEXdDO2ut3YA:10 Received: from [172.20.10.4] (unknown [77.75.241.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by helix.aillwee.com (Postfix) with ESMTPSA id 7B9B54E6CD; Sun, 28 Oct 2018 14:26:06 +0000 (GMT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: [alsa-devel] [PATCH v2] staging: bcm2835-audio: interpolate audio delay From: Mike Brady In-Reply-To: Date: Sun, 28 Oct 2018 14:26:12 +0000 Cc: Kirill Marinushkin , stefan.wahren@i2se.com, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org, f.fainelli@gmail.com, eric@anholt.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, linux-rpi-kernel@lists.infradead.org, nishka.dasgupta_ug18@ashoka.edu.in, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 8BIT Message-Id: <126FA055-050B-4AAC-9392-CA8CCA821768@eircom.net> References: <20181022191708.GA4659@ubuntu> <046aea96-e0d3-60f4-c61a-c26bb1b5c193@gmail.com> <9884c4f5-2343-e3a4-8d8b-dd2db404ef27@gmail.com> To: Takashi Iwai X-Mailer: Apple Mail (2.3445.100.39) X-CMAE-Envelope: MS4wfNJXJWIA8zFo7T3zMz66ebeaL/jBU7Ay6GNnjEDnD4NwjhNVbbay36/n+jPjzVrHK3qJfyrr3KkMw1KFpWKYWK/F11KKPNmFbskmWbpyBNvU/DBGCc3j nKEusel5Ihv1CDV+FoaLZRm4jN13efbvxE1Sc5uzpzxsgoHxL2Z6U+G0wHXMfmED8UYkWpuIWLi+Xr2+OyZfg0uHAxpfvPVLs6VKrgNTXlnSsGC1uuP3AOnT BrXzOMawo+4mySks3mgkfBkHfsFXv/10jtXqjAWO21aBRMx1HKi7MYLZ6684ZjQA0k6ULbxPE52KbcnqqyxWA3E8wtGnxlsJrFkCqY3qYw58GtBbsVsiCAC/ Y5bUaoDm062j5RL8rKVQAuIZdwlV4nCIWfEMWA6Lyj1vTqyNsOIwOqjMrIFknVi6+CWaFW0WStRZ8i7NMAgu3HxSfLxdGikHeiZMbHDAjOhXwAPmirvbr+CV kExkHG0I1bgxdfFwc6erMcRI6X66mSbRUEPGkdlRLfMsNtLEEBeeEKiKv9PvsrXaQa+aHKl2ndYNf4qF1V7wLGDV7jYJv8jKaXQ5shxXiTw6GojlPtAGBUjH 5G5LsHDI+mjfs9CYFHxwilCrUiMXscVU/hm0qpEivqAx/8fmkvHZhdQHux0j4SADlLg= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 25 Oct 2018, at 08:37, Takashi Iwai wrote: > > On Thu, 25 Oct 2018 00:02:34 +0200, > Kirill Marinushkin wrote: >> >>>> When you play sound - the pointer increments. >>> >>> Unfortunately, when you play sound, the pointer does not actually increment, for up to about 10 milliseconds. I know of no way to actually access the true “live” position of the frame that is being played at any instant; hence the desire to estimate it. >>> >> >> Your vision of situation in the opposite from my vision. What you see as a >> symptom - I see as a root cause. As I see, you should fix the >> pointer-not-incrementing. Why do you think that it's okay that the pointer is >> not updating during sound play? Why do you insist that there is a delay? I don't >> understand why we are so stuck here. > > Well, in the API POV, it's nothing wrong to keep hwptr sticking while > updating only delay value. It implies that the hardware chip doesn't > provide the hwptr update. > > Though, usually the delay value is provided also from the hardware, > e.g. reading the link position or such. It's a typical case like > USB-audio, where the hwptr gets updated and the delay indicates the > actual position *behind* hwptr. That works because hwptr shows the > position in the ring buffer at which you can access the data. And it > doesn't mean that hwptr is the actually playing position, but it can > be ahead of the current position, when many samples are queued on > FIFO. The delay is provided to correct the position back to the > actual point. > > But, this also doesn't mean that the delay shouldn't be used for the > purpose like this patchset, either. OTOH, providing a finer hwptr > value would be likely more apps-friendly; there must be many programs > that don't evaluate the delay value properly. > > So, I suppose that hwptr update might be a better option if the code > won't become too complex. Let's see. Indeed. It will take me a few days to look into this… Regards Mike > One another thing I'd like to point out is that the value given in the > patch is nothing but an estimated position, optimistically calculated > via the system timer. Mike and I had already discussion in another > thread, and another possible option would be to provide the proper > timestamp-vs-hwptr pair, instead of updating the timestamp always at > the status read. > > Maybe it's worth to have a module option to suppress this optimistic > hwptr update behavior, in case something went wrong with clocks? > > > thanks, > > Takashi