Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752356AbcLFHNd (ORCPT ); Tue, 6 Dec 2016 02:13:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:57620 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427AbcLFHNa (ORCPT ); Tue, 6 Dec 2016 02:13:30 -0500 Date: Tue, 06 Dec 2016 08:13:16 +0100 Message-ID: From: Takashi Iwai To: "Jiada Wang" Cc: , , , , , Subject: Re: [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize In-Reply-To: <20161206054615.29187-2-jiada_wang@mentor.com> References: <20161206054615.29187-1-jiada_wang@mentor.com> <20161206054615.29187-2-jiada_wang@mentor.com> 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.1 (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 Content-Length: 1659 Lines: 45 On Tue, 06 Dec 2016 06:46:14 +0100, Jiada Wang wrote: > > From: Andreas Pape > > 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 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. Clemens, are you OK with this change? Takashi > > Signed-off-by: Andreas Pape > Signed-off-by: Jiada Wang > --- > sound/usb/endpoint.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c > index c470251..a2931f4 100644 > --- 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 > -- > 2.9.3 >