Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536672 > unrolled thread

[PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize

Started byJiada Wang <jiada_wang@mentor.com>
First post2016-12-06 06:50 +0100
Last post2016-12-06 13:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize Jiada Wang <jiada_wang@mentor.com> - 2016-12-06 06:50 +0100
    Re: [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize Takashi Iwai <tiwai@suse.de> - 2016-12-06 08:20 +0100
    Re: [alsa-devel] [PATCH v2 1/2] ALSA: usb-audio: more tolerant         packetsize Clemens Ladisch <clemens@ladisch.de> - 2016-12-06 13:20 +0100

#1536672 — [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize

FromJiada Wang <jiada_wang@mentor.com>
Date2016-12-06 06:50 +0100
Subject[PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize
Message-ID<sLgNz-6if-3@gated-at.bofh.it>
From: Andreas Pape <apape@de.adit-jv.com>

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.

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

[toc] | [next] | [standalone]


#1536705

FromTakashi Iwai <tiwai@suse.de>
Date2016-12-06 08:20 +0100
Message-ID<sLicG-7oX-13@gated-at.bofh.it>
In reply to#1536672
On Tue, 06 Dec 2016 06:46:14 +0100,
Jiada Wang wrote:
> 
> From: Andreas Pape <apape@de.adit-jv.com>
> 
> 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 <apape@de.adit-jv.com>
> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> ---
>  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
> 

[toc] | [prev] | [next] | [standalone]


#1536897 — Re: [alsa-devel] [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize

FromClemens Ladisch <clemens@ladisch.de>
Date2016-12-06 13:20 +0100
SubjectRe: [alsa-devel] [PATCH v2 1/2] ALSA: usb-audio: more tolerant packetsize
Message-ID<sLmSZ-1WA-9@gated-at.bofh.it>
In reply to#1536672
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web