All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Tsoy <alexander@tsoy.me>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>, Peter Bui <pbui@kernel.bx612.space>
Subject: [PATCH 1/2] ALSA: usb-audio: Fix packet size calculation
Date: Mon, 29 Jun 2020 05:59:33 +0300	[thread overview]
Message-ID: <20200629025934.154288-1-alexander@tsoy.me> (raw)

Commit f0bd62b64016 ("ALSA: usb-audio: Improve frames size computation")
introduced a regression for devices which have playback endpoints with
bInterval > 1. Fix this by taking ep->datainterval into account.

Note that frame and fps are actually mean packet and packets per second
in the code introduces by the mentioned commit. This will be fixed in a
follow-up patch.

Fixes: f0bd62b64016 ("ALSA: usb-audio: Improve frames size computation")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208353
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
---
 sound/usb/endpoint.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 9bea7d3f99f8..11f23778f0a5 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -1093,6 +1093,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
 		ep->freqn = get_usb_high_speed_rate(rate);
 		ep->fps = 8000;
 	}
+	ep->fps >>= ep->datainterval;
 
 	ep->sample_rem = rate % ep->fps;
 	ep->framesize[0] = rate / ep->fps;
-- 
2.26.2


             reply	other threads:[~2020-06-29  3:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29  2:59 Alexander Tsoy [this message]
2020-06-29  2:59 ` [PATCH 2/2] ALSA: usb-audio: Replace s/frame/packet/ where appropriate Alexander Tsoy
2020-06-30 17:48   ` Takashi Iwai
2020-06-30 17:47 ` [PATCH 1/2] ALSA: usb-audio: Fix packet size calculation 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=20200629025934.154288-1-alexander@tsoy.me \
    --to=alexander@tsoy.me \
    --cc=alsa-devel@alsa-project.org \
    --cc=pbui@kernel.bx612.space \
    --cc=tiwai@suse.de \
    --subject='Re: [PATCH 1/2] ALSA: usb-audio: Fix packet size calculation' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.