From patchwork Wed May 20 06:36:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6442531 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8FF199F1C1 for ; Wed, 20 May 2015 06:37:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9530203DA for ; Wed, 20 May 2015 06:37:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E09CC2039E for ; Wed, 20 May 2015 06:37:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 426C22614C1; Wed, 20 May 2015 08:37:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2318E26078A; Wed, 20 May 2015 08:36:59 +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 D7E93260710; Wed, 20 May 2015 08:36:57 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 00BBD260710 for ; Wed, 20 May 2015 08:36:52 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BE7E2AC5D; Wed, 20 May 2015 06:36:51 +0000 (UTC) Date: Wed, 20 May 2015 08:36:51 +0200 Message-ID: From: Takashi Iwai To: Alan Horstmann In-Reply-To: <201505192022.50591.gineera@aspect135.co.uk> References: <201504180908.47022.gineera@aspect135.co.uk> <201505010836.47714.gineera@aspect135.co.uk> <201505192022.50591.gineera@aspect135.co.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") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Assert in pcm_params.c 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 At Tue, 19 May 2015 20:22:50 +0100, Alan Horstmann wrote: > > On Tuesday 19 May 2015 13:01, Takashi Iwai wrote: > > At Fri, 1 May 2015 08:36:47 +0100, Alan Horstmann wrote: > > > A minimal self-contained demo program ('test-format') has been developed > > > and is attached, that demonstrates the issue 100% on the reporters > > > machine (HDA-Intel, 6-ch I believe). The output is: > > > > > > root@Xeon:/home/patest# ./test-format > > > Testing device front > > > Num channels 6 > > > Testing rate: 22050   Result:...Invalid Sample Rate > > > Testing rate: 32000   Result:...Invalid Sample Rate > > > test-format: pcm_params.c:2249: snd1_pcm_hw_params_slave: Assertion `err > > > >= 0' failed. > > > Testing rate: 44100   Aborted > > > > > > Alsa-info is at: > > > > > > http://www.alsa-project.org/db/?f=19dfeee29f73007e61a00a8fabe3c958f7cb8e8 > > >7 > > > > > > This apparently happens with or without Pulseaudio running, with just the > > > single 44100 rate, and also with surround devices. Also, on all current > > > Debian and Ubuntu - we have focused on Jessie. > > > > > > I do not have a machine with similar hardware, so cannot duplicate the > > > results. > > > > > > Any comments, ideas etc would be appreciated. > > > > I also can't reproduce this. So this must be pretty specific to the > > setup. > > > > Could you give the exact condition to trigger the problem? Also, this > > happens certainly with the latest alsa-lib? > > Thanks for taking a look. Just compiling and running that test program, on > the reporter's machine, which has some sort of multi-channel HDA-Intel, is > 100% reproducible. The Alsa-lib must be the one provided by Debian Jessie > (which was released 25.4.2015); 1.0.28 I think. Does the Alsa-info give > enough details - I can ask any specific questions. > > However, Raymond seems to have some ideas of a possible cause, in connection > with arbitrary period size and softvol; is that plausible? Possibly, but I wonder why I couldn't see it when I tried with different module options. In anyway, the fix would be simple, the patch like below. Could you check whether it actually fixes your issue? thanks, Takashi diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 6e57904e445b..1d667a583151 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -2244,9 +2244,11 @@ int snd_pcm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t slave_params; int err; err = sprepare(pcm, &slave_params); - assert(err >= 0); + if (err < 0) + return err; err = schange(pcm, params, &slave_params); - assert(err >= 0); + if (err < 0) + return err; err = sparams(pcm, &slave_params); if (err < 0) cchange(pcm, params, &slave_params);