From: Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>,
Eldad Zack <eldad-v6AqZgAe4C4dvzyIwGCCOg@public.gmane.org>,
USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
James Stone <jamesmstone-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [alsa-devel] Buffer size for ALSA USB PCM audio
Date: Tue, 27 Aug 2013 09:19:49 +0200 [thread overview]
Message-ID: <521C5315.3030207@ladisch.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1308261419100.886-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
Alan Stern wrote:
>> All the difficulty arises from the fact that we don't know beforehand
>> how many URBs will constitute an ALSA period since for playback
>> endpoints, the URB sizes can vary. [...]
>> the number of URBs per period is fixed, and the number of packets in
>> each URB is adjusted during playback so that all the URBs end up
>> having roughly the same number of frames.
>> [...]
>> The parameter calculation now ends up being the same for both recording
>> and playback endpoints. This may seem odd, but it follows from the
>> reasoning above.
There is no reasoning about capture endpoints.
The driver cannot control how many samples actually end up in a capture
packet, so it is possible that URBs end up being one USB frame longer
than a period, in which case the ALSA period interrupts will accumulate
delays of up to one period, or that URBs end up being one USB frame
shorter than a period, in which case the ALSA period interrupt will be
delayed to the end of the _next_ URB.
The current algorithm uses very short capture URBs to ensure that _some_
URB is completed as soon as possible after a period ends.
Your patch makes things worse for running jackd at lower latencies
because playback and capture period interrupts are expected to be more
or less synchronous (jackd waits for both interrupts before acting on
one period). With only two periods per buffer and the capture period
interrupt randomly delayed by up to one period, the time available for
processing one period is reduced to zero.
I'd suggest to keep the old calculation for capture URBs. It would
make sense to use longer capture URBs only if the period size is
relatively large.
Note: for capturing, the number of URBs has no effect on latency and
just reduces the risk of overruns, so it is desirable to make the queue
as long as possible (for a given URB length).
> Not having heard any responses to the patch posted last Wednesday,
Sorry, my #patches / free_time quotient is rather large.
Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-08-27 7:19 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-24 14:41 Buffer size for ALSA USB PCM audio Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307241013190.1313-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-24 14:54 ` Takashi Iwai
[not found] ` <s5hsiz4knyf.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-07-24 15:22 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307241108180.1313-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-24 15:26 ` Takashi Iwai
[not found] ` <s5hob9skmgs.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-07-24 15:43 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307241138180.1313-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-25 8:24 ` Takashi Iwai
[not found] ` <s5hbo5rkpwm.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-07-25 14:50 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307251043470.882-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-29 10:03 ` Takashi Iwai
[not found] ` <s5hvc3tfzt7.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-07-29 15:00 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307291041410.1479-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-29 17:12 ` Clemens Ladisch
[not found] ` <51F6A262.6010800-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-07-29 18:20 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307291400450.1479-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-07-29 19:23 ` Daniel Mack
[not found] ` <51F6C123.7020407-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-07-29 19:38 ` Alan Stern
2013-07-30 6:43 ` [alsa-devel] " Takashi Iwai
[not found] ` <s5hob9k5z0b.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-08-01 17:11 ` Eldad Zack
2013-08-01 17:37 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1307311645190.1546-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-12 13:22 ` [alsa-devel] " Takashi Iwai
[not found] ` <s5h7gfryrgh.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-08-12 14:53 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308121036460.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-12 15:04 ` Takashi Iwai
[not found] ` <s5hvc3bx85c.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-08-12 16:50 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308121218590.1489-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-13 21:06 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308131659320.897-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-13 21:34 ` Daniel Mack
[not found] ` <520AA657.5010704-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-14 20:50 ` Eldad Zack
2013-08-15 16:06 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308151136180.905-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-18 16:56 ` Clemens Ladisch
2013-08-14 18:34 ` Clemens Ladisch
[not found] ` <520BCDBC.2060507-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-08-21 21:37 ` [alsa-devel] " Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308211654010.1297-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-26 18:37 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308261419100.886-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-27 6:32 ` James Stone
[not found] ` <CABRv+91ZGMHbHZFW0gYOL-zGP=HbmiJU51z-_C_2Jj+5ATisrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-27 16:53 ` Alan Stern
2013-08-27 7:19 ` Clemens Ladisch [this message]
2013-08-27 8:01 ` Pavel Hofman
[not found] ` <521C5CC2.7030809-49v42ZqfXVBBDgjK7y7TUQ@public.gmane.org>
2013-08-27 8:11 ` [alsa-devel] " Clemens Ladisch
[not found] ` <521C5315.3030207-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-08-27 16:50 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308271246130.1810-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-27 20:03 ` Clemens Ladisch
[not found] ` <521D060E.4-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-08-27 20:11 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308271608430.940-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-28 6:41 ` Clemens Ladisch
[not found] ` <521D9BAE.2060508-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-08-28 18:46 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308281441090.1541-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-29 8:10 ` James Stone
[not found] ` <CABRv+92cJPKVT9f2dyHJ_rg6sX3hP9Ct6QFas771fS79h7Eu2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-29 15:00 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308291059300.1170-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-29 17:45 ` James Stone
2013-08-29 18:42 ` Alan Stern
[not found] ` <CABRv+93oVW0rDEJnNeGyfqem2PM42b28-z9q+Ze8r7rky7szDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-03 14:04 ` [alsa-devel] " Alan Stern
2013-09-22 21:50 ` Eldad Zack
2013-09-09 14:20 ` Daniel Mack
[not found] ` <522DD92C.4020009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-09 15:36 ` Alan Stern
2013-08-13 21:54 ` Clemens Ladisch
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=521C5315.3030207@ladisch.de \
--to=clemens-p6gi/4k7komelga04laivw@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=eldad-v6AqZgAe4C4dvzyIwGCCOg@public.gmane.org \
--cc=jamesmstone-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=tiwai-l3A5Bk7waGM@public.gmane.org \
--cc=zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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).