linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: tiwai@suse.com
Cc: Jiada Wang <jiada_wang@mentor.com>,
	perex@perex.cz, o-takashi@sakamocchi.jp,
	alsa-devel@alsa-project.org, apape@de.adit-jv.com,
	linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize
Date: Tue, 6 Dec 2016 13:11:13 +0100	[thread overview]
Message-ID: <8ec36827-450e-ff5a-5183-75b31ec95dc3@ladisch.de> (raw)
In-Reply-To: <20161206054615.29187-2-jiada_wang@mentor.com>

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 <apape@de.adit-jv.com>
> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>

Acked-by: Clemens Ladisch <clemens@ladisch.de>

> --- 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

  parent reply	other threads:[~2016-12-06 12:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06  5:46 [PATCH 0/2 v2] usb-audio misc fix Jiada Wang
2016-12-06  5:46 ` [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize Jiada Wang
2016-12-06  7:13   ` Takashi Iwai
2016-12-06 12:11   ` Clemens Ladisch [this message]
2016-12-06  5:46 ` [PATCH 2/2] ALSA: usb-audio: avoid setting of sample rate multiple times on bus Jiada Wang
2016-12-06 15:02 ` [PATCH 0/2 v2] usb-audio misc fix Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ec36827-450e-ff5a-5183-75b31ec95dc3@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=apape@de.adit-jv.com \
    --cc=jiada_wang@mentor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).