From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753203AbcEIMRY (ORCPT ); Mon, 9 May 2016 08:17:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:34492 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbcEIMRX (ORCPT ); Mon, 9 May 2016 08:17:23 -0400 Date: Mon, 09 May 2016 14:17:21 +0200 Message-ID: From: Takashi Iwai To: Mark Brown Cc: Peter Rosin , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Liam Girdwood Subject: Re: [alsa-devel] [PATCH] ASoC: pcm: allow changing the playback/capture rates for symmetric links In-Reply-To: <20160504164922.GB6292@sirena.org.uk> References: <1461746959-11443-1-git-send-email-peda@axentia.se> <20160427161504.GZ3217@sirena.org.uk> <122ca84a-230e-654e-425f-3adb0ca00ec7@axentia.se> <20160428103822.GJ3217@sirena.org.uk> <20160504164922.GB6292@sirena.org.uk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 04 May 2016 18:49:22 +0200, Mark Brown wrote: > > On Mon, May 02, 2016 at 09:43:53AM +0200, Peter Rosin wrote: > > > The problem is in the drain/close part. If I leave out snd_pcm_drain > > I naturally lose the tail of the output, but if I have it I get what > > I guess is a repeat of the content in some circular buffer. I.e. the > > very last part of the played sound is played twice(ice). > > > If I instead write the generated samples to a file and play them > > with aplay, all is fine, so I appear to be misunderstanding the > > alsa api? > > > Anything obviously wrong in the above code? > > Look at how aplay handles this... it's a natural consequence of the > hardware being free running. You need to either make the teardown > non-blocking or play some silence at the end. Right, usually the transfer is aligned with the period size, and the application is supposed to fill the period size at least. Takashi