From: Giuliano Pochini <pochini@shiny.it>
To: "Harsha, Priya" <priya.harsha@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: .pointer return value
Date: Sat, 25 Apr 2009 14:20:02 +0200 [thread overview]
Message-ID: <20090425142002.1e2ddb1a@Jay> (raw)
In-Reply-To: <98769532B4BB14429434178695419EAE4AA6D20B@bgsmsx501.gar.corp.intel.com>
On Thu, 23 Apr 2009 19:34:08 +0530
"Harsha, Priya" <priya.harsha@intel.com> wrote:
> Can anyone educate me on what value should be returned to .pointer function?
> Should I be passing the number of frames played till that point from the time stream started or thnumber of frames played such that the bytes is within the buf_size?
The latter: it's the index of the last transferred frame in the ring buffer.
> And if I am using, snd_pcm_indirect_playback_pointer, what should be my input to it?
> Should I be passing the number of bytes played till that point from the time stream started or the number of bytes within buf_size?
In practice, they're both fine. After a quick look at the sources
in /include/sound/pcm-indirect.h:
----
static inline snd_pcm_uframes_t
snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec, unsigned int ptr) {
int bytes = ptr - rec->hw_io;
if (bytes < 0)
bytes += rec->hw_buffer_size;
rec->hw_io = ptr;
----
It cares about the difference from the last position to the current one and
it adds hw_buffer_size if ptr wrapped around.
Side note:
I can guess it may not behave correctly in case of long latencies when
bytes < -hw_buffer_size. Perhaps should the "if" be changed to "while" ?
--
Giuliano.
next prev parent reply other threads:[~2009-04-25 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 14:04 .pointer return value Harsha, Priya
2009-04-25 12:20 ` Giuliano Pochini [this message]
2009-04-25 17:13 ` Harsha, Priya
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=20090425142002.1e2ddb1a@Jay \
--to=pochini@shiny.it \
--cc=alsa-devel@alsa-project.org \
--cc=priya.harsha@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 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.