From: "Alexander E. Patrakov" <patrakov@gmail.com>
To: Raymond Yau <superquad.vortex2@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>,
ALSA Development Mailing List <alsa-devel@alsa-project.org>,
Clemens Ladisch <clemens@ladisch.de>,
David Henningsson <david.henningsson@canonical.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>
Subject: Re: Master Plan on rewinding
Date: Sun, 14 Sep 2014 18:07:23 +0600 [thread overview]
Message-ID: <541584FB.2030208@gmail.com> (raw)
In-Reply-To: <CAN8cciYj4fo01XZwJ-NhFQDNv6Ua5mqaAEq1zU7PYxHkJyOQ5A@mail.gmail.com>
14.09.2014 17:37, Raymond Yau wrote:
>
> >
> >
> >> === On the rewind safeguard ===
> >
> >
> > Result 1: it has been decided that the return value of
> snd_pcm_rewindable() is not changed, and the safeguard is returned by a
> separate function.
>
> It is unlikely to return any value which is safe, it is the
> responsiability of the application to decide how much can be rewind
You are placing a responsibility on an application without giving it any
means to make an informed decision. E.g. 4 ms is OK on snd-hda-intel,
but definitely not OK on ymfpci even on infinitely fast CPU (because of
the fixed 5 ms interrupt interval). The whole question here is: how is
an application supposed to know that?
>
> If pulseaudio assume 20ms process time is require to process two seconds
> of audio and sleep for 1980ms, it should not assume cpu have infinite power
You are right. The safeguard interval is a sum of the CPU-independent
but card-specific part (which is what is being talked about) and a
CPU-specific part (which the application indeed should know).
>
> what is the purpose of the timestamp ?
>
> Can the timestamp use to predict when will next period update occur if
> the timestamp is obtained at previous period update ?
See http://0pointer.de/blog/projects/pulse-glitch-free.html
>
> Why snd_pcm_rewind cannot return error when application just set stop
> threshold to buffer size and rewind more than the stop threshold ?
I think it does. The problem (due to which we need a safeguard) is that
the card-specific minimum number of not-really-rewindable samples
exists. E.g., for ymfpci, that would be 5 ms.
>
> :This would require documentation changes for snd_pcm_rewindable(),
> though, as it officially no longer returns "safe count of frames which
> can be rewinded". I have difficulty designing a better wording what the
> function actually means now.
>
> The word "safe" should be removed
That's insufficient. The returned value is valid only in the ring-buffer
model for a card that fetches samples absolutely uniformly one at a
time, i.e. without any batching, updates the pointer at every
played-back sample, and doesn't have any "don't overwrite what I am
DMA-ing or I will kill you with IRQs" quirk. I.e., even with the
infinitely fast CPU, an attempt to rewind as much as that function
returns (and then overwrite) will yield a glitch (that may or may not be
detected as xrun even if xrun detection is enabled).
--
Alexander E. Patrakov
next prev parent reply other threads:[~2014-09-14 12:07 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-07 15:16 Master Plan on rewinding Alexander E. Patrakov
2014-09-07 18:38 ` Tanu Kaskinen
2014-09-07 19:05 ` Alexander E. Patrakov
2014-09-07 20:51 ` Clemens Ladisch
2014-09-08 3:06 ` Raymond Yau
2014-09-08 7:31 ` Alexander E. Patrakov
2014-09-09 8:43 ` Clemens Ladisch
2014-09-09 8:55 ` Alexander E. Patrakov
2014-09-09 9:08 ` David Henningsson
2014-09-09 9:31 ` Alexander E. Patrakov
2014-09-21 2:02 ` Raymond Yau
2014-09-22 13:20 ` Lars-Peter Clausen
2014-09-22 13:36 ` Alexander E. Patrakov
2014-09-22 13:44 ` Lars-Peter Clausen
2014-09-23 8:29 ` Raymond Yau
2014-09-23 10:22 ` Alexander E. Patrakov
2014-09-09 13:45 ` Clemens Ladisch
2014-09-09 15:55 ` Alexander E. Patrakov
2014-09-09 16:09 ` Takashi Iwai
2014-09-07 23:12 ` David Henningsson
2014-09-09 19:56 ` Pierre-Louis Bossart
2014-09-10 5:38 ` Alexander E. Patrakov
2014-09-08 7:34 ` Lars-Peter Clausen
2014-09-08 7:59 ` David Henningsson
2014-09-08 8:46 ` Alexander E. Patrakov
2014-09-08 9:26 ` David Henningsson
2014-09-08 10:21 ` Alexander E. Patrakov
2014-09-09 8:43 ` Clemens Ladisch
2014-09-11 3:49 ` Raymond Yau
2014-09-11 4:19 ` A. C. Censi
2014-09-13 9:15 ` Raymond Yau
2014-09-11 5:28 ` Alexander E. Patrakov
2014-09-11 6:21 ` Raymond Yau
2014-09-13 8:57 ` Raymond Yau
2014-09-13 10:43 ` Alexander E. Patrakov
2014-09-13 11:33 ` Raymond Yau
2014-09-13 11:36 ` Alexander E. Patrakov
2014-09-13 18:35 ` Alexander E. Patrakov
2014-09-14 11:37 ` Raymond Yau
2014-09-14 12:07 ` Alexander E. Patrakov [this message]
2014-09-15 2:43 ` Raymond Yau
2014-09-15 9:19 ` Takashi Iwai
2014-09-15 9:58 ` Alexander E. Patrakov
2014-09-15 10:08 ` Takashi Iwai
2014-09-15 17:01 ` Pierre-Louis Bossart
2014-09-15 17:14 ` Alexander E. Patrakov
2014-09-15 18:08 ` Takashi Iwai
2014-09-18 1:15 ` Raymond Yau
2014-09-21 9:22 ` Alexander E. Patrakov
2014-09-21 9:53 ` Clemens Ladisch
2014-09-21 10:56 ` Alexander E. Patrakov
2014-09-22 3:27 ` 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=541584FB.2030208@gmail.com \
--to=patrakov@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=david.henningsson@canonical.com \
--cc=o-takashi@sakamocchi.jp \
--cc=superquad.vortex2@gmail.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