Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Takashi Iwai <tiwai@suse.de>,
	Clemens Ladisch <clemens@ladisch.de>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Arun Raghavan <arun@accosted.net>,
	David Henningsson <david.henningsson@canonical.com>
Subject: Re: PulseAudio and SNDRV_PCM_INFO_BATCH
Date: Mon, 22 Jun 2015 17:49:22 +0500	[thread overview]
Message-ID: <55880452.7000100@gmail.com> (raw)
In-Reply-To: <CAN8ccib-qYEFK95GYiN-PW9PLXkLZhC+Z2JbsLzdb7ye5aaFWA@mail.gmail.com>

22.06.2015 17:34, Raymond Yau wrote:
>
>  >>>
>  >>> The ALSA API requires the driver to provide a cyclic sample buffer (or
>  >>> something that behaves like one).
>  >>>
>  >>> However, not all hardware works this way.  USB and FireWire require the
>  >>> driver to continually queue new packets, whose size and timing are
>  >>> determined by the bus clock and are not directly related to the ALSA
>  >>> ring buffer.  These drivers use double buffering; the actual DMA
> happens
>  >>> from those packets, not from the ring buffer.
>  >>>
>  >>
>  >> If those queued packets/urb cannot be rewind, snd_pcm_rewindable should
>  >> return zero for those driver
>  >
>  >
>  > Not really.
>  >
>  > As I understand it, the kernel periodically converts a piece of the
> ring buffer (located in RAM) into an URB, and it gets sent through the
> USB bus. Parts of the buffer that are not yet converted to URB are
> perfectly rewindable.
>  >
>  > In other words, for USB devices, the kernel already implements the
> "low-latency background thread that makes unrewindable devices
> rewindable" idea that I discussed (as a strawman proposal) here for
> userspace:
>  >
>  >
> http://mailman.alsa-project.org/pipermail/alsa-devel/2014-September/080868.html
>  >
>
> This mean that SNDRV_PCM_INFO_BATCH represent exact one period is not
> correct for usb and firewire since hw_ptr does not increment in period size

Well, according to the new definition, "SNDRV_PCM_INFO_BATCH on the 
other hand has become to mean that the device is only capable of 
reporting the audio pointer with a coarse granularity". In the USB case, 
we indeed have coarse granularity (6 ms in the worst case), but not as 
bad as one period.

>
> Do this mean .period_bytes_min of snd-usb-audio is incorrect since
> .period_bytes_min should be at least size of urb/packet ?
>

I don't see anything wrong here. With the USB device that my colleague 
has here at work, the minimum period size is 48 samples, i.e. 1 ms, 
which looks exactly like one USB data packet.

-- 
Alexander E. Patrakov

  reply	other threads:[~2015-06-22 12:47 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 12:29 PulseAudio and SNDRV_PCM_INFO_BATCH Arun Raghavan
2015-06-12 12:32 ` Arun Raghavan
2015-06-12 13:43   ` Alexander E. Patrakov
2015-06-12 13:57     ` Alexander E. Patrakov
2015-06-17  3:04     ` Raymond Yau
2015-06-17  3:38       ` Alexander E. Patrakov
2015-06-15  3:42   ` Raymond Yau
2015-06-15  8:03 ` Lars-Peter Clausen
2015-06-15 11:39   ` Raymond Yau
2015-06-15 12:01     ` Lars-Peter Clausen
2015-06-15 13:34       ` Raymond Yau
2015-06-15 14:16         ` Lars-Peter Clausen
2015-06-16  2:33           ` Raymond Yau
2015-06-17  8:27             ` Lars-Peter Clausen
2015-06-17  9:19               ` Takashi Iwai
2015-06-17 15:09                 ` David Henningsson
2015-06-17 16:48                   ` Alexander E. Patrakov
2015-06-18  3:15                     ` Raymond Yau
2015-06-19 11:19                       ` Alexander E. Patrakov
2015-06-19  1:17                   ` Raymond Yau
2015-06-19 11:32                   ` Takashi Iwai
2015-06-20  3:24                     ` Raymond Yau
2015-06-20  6:17                     ` Raymond Yau
2015-06-22  2:35           ` Raymond Yau
2015-06-22  6:43             ` Lars-Peter Clausen
2015-06-22  7:49               ` Raymond Yau
2015-06-22  9:41               ` Clemens Ladisch
2015-06-22 11:54                 ` Raymond Yau
2015-06-22 12:10                   ` Alexander E. Patrakov
2015-06-22 12:34                     ` Raymond Yau
2015-06-22 12:49                       ` Alexander E. Patrakov [this message]
2015-06-22 15:50                         ` Raymond Yau
2015-06-22 16:28                           ` Alexander E. Patrakov
2015-06-24  5:51                             ` Raymond Yau
2015-06-22 22:52                     ` Takashi Sakamoto
2015-06-27 15:28   ` Alexander E. Patrakov
2015-06-27 17:15     ` Clemens Ladisch
2015-06-27 17:58       ` Alexander E. Patrakov
2015-06-28  2:09         ` Raymond Yau

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=55880452.7000100@gmail.com \
    --to=patrakov@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arun@accosted.net \
    --cc=clemens@ladisch.de \
    --cc=david.henningsson@canonical.com \
    --cc=lars@metafoo.de \
    --cc=superquad.vortex2@gmail.com \
    --cc=tanu.kaskinen@linux.intel.com \
    --cc=tiwai@suse.de \
    /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