From: Hans-Kristian Arntzen <maister@archlinux.us>
To: alsa-devel@alsa-project.org
Subject: Troubles using the external SDK
Date: Thu, 18 Feb 2010 23:44:49 +0100 [thread overview]
Message-ID: <4B7DC2E1.6050106@archlinux.us> (raw)
In-Reply-To: <mailman.5292.1266501879.2074.alsa-devel@alsa-project.org>
I am trying to make an alsa output plugin that streams the audio over
network (something like esd, just even more simplistic) using the
external SDK, however, I am having trouble implementing some things
correctly it seems, and the docs weren't descriptive enough.
So far, it works quite well with music playback that doesn't really care
about audio blocking, etc. The main problem is audio sync and blocking
with more complex applications like MPlayer. As far as I can see in the
MPlayer source, to retain audio sync, it uses
snd_pcm_delay() for delay, and
snd_pcm_status_get_avail() to figure out how much it can write
without audio blocking.
This is fine, but how can snd_pcm_status_get_avail() get the data it
needs from the plugins? It doesn't seem to call on any callbacks to do this.
It seems so far that snd_pcm_status_get_avail() always returns
buffer_size, since I seem to get working audio, but the video starts to
stutter. The stuttering goes away when I force a really small maximum
buffer size (we're talking 512-ish bytes), but this is really, really
bad, and doesn't work
too well on my netbook (performance/timing issues I guess). Is it
possible to define a snd_pcm_status_get_avail() callback in the SDK in
some way?
Anyways. I want to know how you'd do this. The OSS driver for example
doesn't even seem to define a delay() callback, which strikes me as odd.
How can it know about the delay?
Also, I want to know the reasoning behind the pointer() function. It
seems to be called all the time. I don't know what it really does, and
what good it does. Is it supposed to represent where in the buffer we
are? As in, it's supposed to stay somewhere between 0 and buffer_size?
If so, my experience with it doesn't make sense at all. If I return that
actual value, the programs simply stop up and loop endlessly over the
pointer() function. The temporary "hack" (as in probably very wrong) was
to return the total amount of data that's been sent since the start. Can
anyone help a frustrated programmer? :P
-- Themaister
next parent reply other threads:[~2010-02-18 22:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5292.1266501879.2074.alsa-devel@alsa-project.org>
2010-02-18 22:44 ` Hans-Kristian Arntzen [this message]
2010-02-25 0:27 Troubles using the external SDK 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=4B7DC2E1.6050106@archlinux.us \
--to=maister@archlinux.us \
--cc=alsa-devel@alsa-project.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).