From: mru@users.sourceforge.net (Måns Rullgård)
To: alsa-devel@lists.sourceforge.net
Subject: Re: ring buffer pointer accuracy.
Date: Mon, 14 Jul 2003 18:53:19 +0200 [thread overview]
Message-ID: <yw1xk7al82yo.fsf@users.sourceforge.net> (raw)
In-Reply-To: XFMail.20030714175754.pochini@shiny.it
Giuliano Pochini <pochini@shiny.it> writes:
>> I would like some idea of how accurate the snd_pcm_delay() result is
>> likely to be. If I am trying to syncronise video to audio, and I notice
>> a difference between audio and video, I need to know how accurate I can
>> make it.
>
> I suppose you need a precision of 42ms (the duration of a cinema frame).
> You can read the position at intervals <= 42ms. If the value you read is
> different then the previous one, you know that value is up to date.
> You know exactly when you started to play the sound. If you do your own
> timing and you take into account the period time, you only need to read
> position 3-4 times every 10s or so to check if you are losing sync.
You could use the ALSA timer interface. It gives a resolution equal
to the period time. If that's too long time, you can use the system
clock to interpolate.
> Even if you have a really bad soundcard, it's unlikely the sample clock
> skews more than 1%.
1% would be about a minute at the end of normal movie. That's not
what I like to call acceptable.
>> If some cards only update "delay" once per period, but others update it
>> all the time, I would like the application to know about it, so it can
>> decide how accurately it can actually get audio and video in sync.
>
> You can use shorter periods if your cards allows it.
Most cards I've come across support period lengths of down to 10 ms or
less. That's plenty enough for video playback.
--
Måns Rullgård
mru@users.sf.net
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
prev parent reply other threads:[~2003-07-14 16:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-10 15:31 ring buffer pointer accuracy James Courtier-Dutton
2003-07-11 15:28 ` Giuliano Pochini
2003-07-14 14:29 ` Takashi Iwai
2003-07-14 14:51 ` James Courtier-Dutton
2003-07-14 15:57 ` Giuliano Pochini
2003-07-14 16:53 ` Måns Rullgård [this message]
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=yw1xk7al82yo.fsf@users.sourceforge.net \
--to=mru@users.sourceforge.net \
--cc=alsa-devel@lists.sourceforge.net \
/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.