Commit fd1a5059 authored by Andreas Pape's avatar Andreas Pape Committed by Takashi Iwai

ALSA: usb-audio: more tolerant packetsize

since commit 57e6dae1 ("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: default avatarAndreas Pape <apape@de.adit-jv.com>
Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
Acked-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 1e2e3fe4
...@@ -632,8 +632,8 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, ...@@ -632,8 +632,8 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
ep->stride = frame_bits >> 3; ep->stride = frame_bits >> 3;
ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0; ep->silence_value = pcm_format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0;
/* assume max. frequency is 25% higher than nominal */ /* assume max. frequency is 50% higher than nominal */
ep->freqmax = ep->freqn + (ep->freqn >> 2); ep->freqmax = ep->freqn + (ep->freqn >> 1);
/* Round up freqmax to nearest integer in order to calculate maximum /* Round up freqmax to nearest integer in order to calculate maximum
* packet size, which must represent a whole number of frames. * packet size, which must represent a whole number of frames.
* This is accomplished by adding 0x0.ffff before converting the * This is accomplished by adding 0x0.ffff before converting the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment