From: Clemens Ladisch <clemens@ladisch.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: 'Sarah Sharp' <sarah.a.sharp@linux.intel.com>,
'ALSA Development Mailing List' <alsa-devel@alsa-project.org>
Subject: Re: USB Audio questions
Date: Tue, 16 Aug 2011 08:37:01 +0200 [thread overview]
Message-ID: <4E4A100D.9020302@ladisch.de> (raw)
In-Reply-To: <000001cc5b8a$4a6577c0$df306740$@bossart@linux.intel.com>
Pierre-Louis Bossart wrote:
> - Is there any good reason why the max number of packets per urb defaults to
> 8?
Not really. It is an attempt to compromise between interrupt frequency
and the latency resulting from packet queueing.
> - Increasing the number of packets/urbs solves my power issue but not the
> synchronization issue. If I reduce the number of urbs to reduce the
> interrupt rate, then the accuracy of the hw_pointer is decreased big time
> and it becomes difficult to synchronize with video. The .pointer routine
> only keeps track of retired urbs, it seems there's no way to know how many
> samples were played at a given time?
Only the URB completion callback tells us about finished packets.
For playback, we know how many bytes we had submitted, so we could
derive the current position from the USB frame counter, but for capture,
we don't know the precise byte count until the HCD has looked at the
descriptors.
> Isn't there a direct way to query the usb core to know how many bytes
> have been transmitted and make the hw_ptr/delay information independent
> of the urb buffer size?
No, this information isn't returned earlier than the completion callback.
It would be nice to be able to tell the HCD to collect information about
all currently completed USB frames, regardless of whether the entire URB
has finished or whether its interrupt flag is set, but this would require
changes in all host controller drivers. (I'm contemplating something
like this for FireWire, but there we have only one controller driver.)
> - Is there any reason why the driver relies on vmalloc and memcpy? It seems
> like using physically-contiguous memory would be more efficient, as done in
> the CAIQ driver?
Why more efficient? You cannot avoid double-buffering when a USB packet
wraps around the end of the ALSA ring buffer.
> - The period information is not updated when the urbs are allocated. In my
> case the period specified was 25ms, but with all the approximations the
> actual period (number of urbs*buffer_size_per_urb) was 24ms.
Please note that URBs are usually not completely filled. For playback,
the driver makes URBs shorter so that they end as nearly as possible on
or after a period boundary; for capture, we cannot predict sample counts,
so the driver just uses one URB per ms.
Regards,
Clemens
next prev parent reply other threads:[~2011-08-16 6:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-15 18:15 [PATCH 1/4] ASoC: DAPM: Allow multiple mixer sources to be routed via the same switch Lars-Peter Clausen
2011-08-15 18:15 ` [PATCH 2/4] ASoC: Add ADAU1373 codec support Lars-Peter Clausen
2011-08-15 20:31 ` USB Audio questions Pierre-Louis Bossart
[not found] ` <4e498227.854fdf0a.0dd4.6281SMTPIN_ADDED@mx.google.com>
2011-08-15 20:55 ` Daniel Mack
2011-08-15 21:48 ` Pierre-Louis Bossart
[not found] ` <000001cc5b8a$4a6577c0$df306740$@bossart@linux.intel.com>
2011-08-16 5:30 ` David Henningsson
2011-08-16 6:47 ` Clemens Ladisch
2011-08-16 6:37 ` Clemens Ladisch [this message]
2011-08-16 7:30 ` Daniel Mack
2011-08-16 15:46 ` Clemens Ladisch
2011-08-16 15:38 ` Pierre-Louis Bossart
[not found] ` <20110816145353.GB5233@xanatos>
2011-08-16 15:44 ` Pierre-Louis Bossart
[not found] ` <000601cc5c2a$87a26350$96e729f0$@bossart@linux.intel.com>
2011-08-16 16:09 ` Clemens Ladisch
2011-08-16 17:19 ` Pierre-Louis Bossart
[not found] ` <000001cc5c38$b07abee0$11703ca0$@bossart@linux.intel.com>
2011-08-17 6:29 ` Clemens Ladisch
2011-08-17 15:21 ` Pierre-Louis Bossart
2011-08-19 22:02 ` Pierre-Louis Bossart
2011-08-16 20:41 ` Torsten Schenk
2011-08-16 22:11 ` Pavel Hofman
2011-08-17 6:36 ` Clemens Ladisch
[not found] ` <000001cc5c5a$e7d5c3e0$b7814ba0$@bossart@linux.intel.com>
2011-08-16 22:13 ` Torsten Schenk
2011-08-16 15:54 ` [PATCH 2/4] ASoC: Add ADAU1373 codec support Mark Brown
2011-08-15 18:15 ` [PATCH 3/4] ASoC: Blackfin: ADAU1373 eval board support Lars-Peter Clausen
2011-08-16 15:54 ` Mark Brown
2011-08-15 18:15 ` [PATCH 4/4] Blackfin: bf537: Stamp: Register ASoC EVAL-ADAU1373 board driver Lars-Peter Clausen
2011-08-16 15:56 ` Mark Brown
2011-08-18 13:52 ` Lars-Peter Clausen
2011-08-15 23:25 ` [PATCH 1/4] ASoC: DAPM: Allow multiple mixer sources to be routed via the same switch Mark Brown
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=4E4A100D.9020302@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sarah.a.sharp@linux.intel.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