Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp561939pxb; Thu, 25 Feb 2021 09:12:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyylAwepBrVMnc8mOKfrjG6DOQbJLLxOD9PV/cXNdhByR/TSKzvEYGtIkpEeawZcxuTukIl X-Received: by 2002:a17:906:688:: with SMTP id u8mr3551210ejb.38.1614273133810; Thu, 25 Feb 2021 09:12:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614273133; cv=none; d=google.com; s=arc-20160816; b=pUOBZ7qDhdQx68tvDTCDNBI71tu/TEopD/TwhLjISAAfl5TzOvoXqWZOm4xELRFgOz IP6PDMcmuomcEqjOaPrG4DDf6Z9LG4T/DjkEAhv3xTfoh6ytasU0Ys/RoS/zWubwj9+P Nd76QbA9Q3bTlXgOwJOttv8JAiOLw0kNWszKI9EYXuG1/dc+jX0YcZj9IjYNjTPAG73M FdOIDg9A/Vg8uiAkmYB/pZ5lyQP7sbcZQ2KH7Po3C20AH7JuNam4Wmuvw+h7y3rtHsuJ JvbIROFObO9JK7xAap7+TMTC6SjgATa2WrwwSr66EinzyMFnaQlZhOhPXbjKunOl8SHr 48Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=Az7p09xiqRjxqAapftgSRyvcwS9oVJ5Lo5t6MQGqnJ0=; b=KdtnSLJ3UDvb0jMwYogDNWBoS7zZQRnQjWFnX5yURDHp97yEO8x0rzug+Hn5Ht7HOO 5cvKcHzqFeulJDm0ajz/0b5xHp0uRNFo55n4MqlN+AADNdx5w2Q4rULGyM5ROoLpFUUQ HY5OhmiI+kC3LiUmtdMdhH+fXc26VRGFt5PzoJ7djfZlxS+AHEmXByAVCzCQvgMa3yF7 Bmrcle3IisBU0//wZ53Vf2BwuIrFVRF9W0wyIkdmgwCfvAUp56SMfFOfpJCOFVczg59C 6KB96GOVfvNJ8M6PKA1TRleYxhBe784l5vgppFLcjpMtchjhrPg6+oIQ7pQQ+ZaHta4h IHsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id he14si3900720ejc.274.2021.02.25.09.11.50; Thu, 25 Feb 2021 09:12:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232608AbhBYRLX (ORCPT + 99 others); Thu, 25 Feb 2021 12:11:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:40112 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbhBYRLT (ORCPT ); Thu, 25 Feb 2021 12:11:19 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 516F6ACCF; Thu, 25 Feb 2021 17:10:37 +0000 (UTC) Date: Thu, 25 Feb 2021 18:10:37 +0100 Message-ID: From: Takashi Iwai To: Heinz Diehl Cc: linux-kernel@vger.kernel.org, lpoetter@redhat.com Subject: Re: [BISECTED] Kernel 5.11.x breaks pulseaudio In-Reply-To: References: 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/25.3 (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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 25 Feb 2021 18:01:53 +0100, Heinz Diehl wrote: > > Hi, > > from kernel 5.11 on, pulseaudio always resamples audio to the sample > rate specified by default-sample-rate, despite "avoid-resampling = > true". Audio that matches alternate-sample-rate is resampled in the same way. > This means that both "alternate-sample-rate" and > "avoid-resampling=true" are no longer working. > > Steps to Reproduce: > 1. Set "avoid-resampling = true" in daemon.conf > 2. Set default-sample-rate = 44100 in daemon.conf > 3. Set alternate-sample-rate 48000 in daemon.conf > 4. Restart pulseaudio > 5. Play a 48000 (or any other) audio file > > Actual results: > File is played as 44100 audio. Pacmd list-sink-inputs shows that > resampling is happening. Play an audio file with any other sample > rate, and it will be resampled to 44100. > > Expected results: > Audio file plays at 48000. Any other file is played in its own sample rate. > > In my case, this affects USB audio. Tried both a Dragonfly Red, a > Fostex HP-A4 and an unknown Soundblaster USB audio dac/amp, and all of > them show the same behaviour as described here. Most probably, the > regression affects all USB audio devices. > > All kernels from the 5.10 series are fine. Here's the offending patch > that introduced the regression. Reverting it on top of kernel 5.11 / > 5.11.1 resolves the problem: > > [root@chiara linux-stable]# git bisect good > e4ea77f8e53f9accb9371fba34c189d0447ecce0 is the first bad commit > commit e4ea77f8e53f9accb9371fba34c189d0447ecce0 > Author: Takashi Iwai > Date: Mon Jan 11 09:16:11 2021 +0100 > > ALSA: usb-audio: Always apply the hw constraints for implicit fb sync > > Since the commit 5a6c3e11c9c9 ("ALSA: usb-audio: Add hw constraint for > implicit fb sync"), we apply the hw constraints for the implicit > feedback sync to make the secondary open aligned with the already > opened stream setup. This change assumed that the secondary open is > performed after the first stream has been already set up, and adds the > hw constraints to sync with the first stream's parameters only when > the EP setup for the first stream was confirmed at the open time. > However, most of applications handling the full-duplex operations do > open both playback and capture streams at first, then set up both > streams. This results in skipping the additional hw constraints since > the counter-part stream hasn't been set up yet at the open of the > second stream, and it eventually leads to "incompatible EP" error in > the end. > > This patch corrects the behavior by always applying the hw constraints > for the implicit fb sync. The hw constraint rules are defined so that > they check the sync EP dynamically at each invocation, instead. This > covers the concurrent stream setups better and lets the hw refine > calls resolving to the right configuration. > > Also this patch corrects a minor error that has existed in the debug > print that isn't built as default. > > Fixes: 5a6c3e11c9c9 ("ALSA: usb-audio: Add hw constraint for implicit fb sync") > Link: https://lore.kernel.org/r/20210111081611.12790-1-tiwai@suse.de > Signed-off-by: Takashi Iwai > > sound/usb/pcm.c | 171 +++++++++++++++++++++++++++++++++++--------------------- > 1 file changed, 108 insertions(+), 63 deletions(-) > [root@chiara linux-stable]# > > Feel free to contact me if you think I can help. It's no regression but the right behavior. This indicates that you're trying a stream in 44.1kHz in one side of the full duplex stream while 48kHz in another rate, and this cannot work properly with the implicit feedback devices. It might have worked casually by some reason on your device, but it was just a coincidence, as it didn't follow exactly what the implicit feedback mode requires (i.e. the playback packet must follow exactly the incoming recording packet). That said, for the device like this, the sample rate has to be fixed for both streams. Hope that clarifies the situation. Takashi