[Openal] latency
Chris Robinson
chris.kcat at gmail.com
Fri Feb 20 20:49:34 PST 2009
On Friday 20 February 2009 11:58:12 am angelo wrote:
> If i start receiving from the PC, sometime there is an initial latency
> of 2/300 msec, some other of more than 1 second.
> Then, if i let the PC receiving, after some minutes the latency grow to
> 4, 5 seconds and more.
Hi.
Do you create a new buffer every time you receive enough data, or do you reuse
old ones? If I had to guess, I would say it's because you're receiving (the
other system is generating) data at a slightly faster rate than it's being
played. This would be typical timer drift.
I'm not sure what the "correct" way to deal with it is, but one possible
method would be to simply drop buffers when you get too many. Set up to have a
max of 'n' buffers, and when when you get 'n+1', simply delete one of them
(after having read it from the network) without queuing it. Another option may
be to slightly increase the pitch so it plays back a little faster and gets
through the older buffers before new ones arrive.
Both ideas have drawbacks, though. Dropping the buffers can cause clicks and
pops, and some lost audio. But increasing the pitch can make the playback
sound funny, and increases the risk of starvation (running out of data while
waiting and having nothing to play).
Might be best to wait and hear what other people have to say. Hope that helps.
More information about the Openal
mailing list