Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcLFMMs (ORCPT ); Tue, 6 Dec 2016 07:12:48 -0500 Received: from dehamd003.servertools24.de ([31.47.254.18]:49052 "EHLO dehamd003.servertools24.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbcLFMMl (ORCPT ); Tue, 6 Dec 2016 07:12:41 -0500 Subject: Re: [alsa-devel] [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize To: tiwai@suse.com References: <20161206054615.29187-1-jiada_wang@mentor.com> <20161206054615.29187-2-jiada_wang@mentor.com> Cc: Jiada Wang , perex@perex.cz, o-takashi@sakamocchi.jp, alsa-devel@alsa-project.org, apape@de.adit-jv.com, linux-kernel@vger.kernel.org From: Clemens Ladisch Message-ID: <8ec36827-450e-ff5a-5183-75b31ec95dc3@ladisch.de> Date: Tue, 6 Dec 2016 13:11:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161206054615.29187-2-jiada_wang@mentor.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-PPP-Message-ID: <20161206121115.111499.34741@dehamd003.servertools24.de> X-PPP-Vhost: ladisch.de Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1395 Lines: 33 Jiada Wang wrote: > since commit 57e6dae1087b ("ALSA: usb-audio: do not trust too-big > wMaxPacketSize values"), the expected packetsize is always limited > to nominal + 25%. It was discovered, that some devices Android audio accessory > have a much > higher jitter in used packetsizes than 25% which would result in BABBLE > condition and dropping of packets. > A better solution is so assume the jitter to be the nominal packetsize: > -one nearly empty packet followed by a almost 150% sized one. > > V2: changed to assume max frequency is +50 of nominal packetsize. > > Signed-off-by: Andreas Pape > Signed-off-by: Jiada Wang Acked-by: Clemens Ladisch > --- a/sound/usb/endpoint.c > +++ b/sound/usb/endpoint.c > @@ -632,8 +632,8 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, > ep->stride = frame_bits >> 3; > ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; > > - /* assume max. frequency is 25% higher than nominal */ > - ep->freqmax = ep->freqn + (ep->freqn >> 2); > + /* assume max. frequency is 50% higher than nominal */ > + ep->freqmax = ep->freqn + (ep->freqn >> 1); > /* Round up freqmax to nearest integer in order to calculate maximum > * packet size, which must represent a whole number of frames. > * This is accomplished by adding 0x0.ffff before converting the