[vlc-devel] workaround audio drops on openbsd
remi at remlab.net
Wed Apr 17 09:00:11 CEST 2013
On Wed, 17 Apr 2013 08:35:14 +0200, Alexandre Ratchov <alex at caoua.org>
>> > @@ -222,7 +226,8 @@ static int TimeGet (audio_output_t *aout, mtime_t
>> > *restrict delay)
>> > if (!sys->started)
>> > return -1;
>> Unfortunately, VLC currently needs to know the latency before playback
>> actually starts. You will get a glitch at startup...
> Do you mean by latency the time it takes to the last frame written
> to hit Joe's ears?
Yes. If you cannot compute that (even indirectly), audio cannot be
synchronized with video.
> I tried it and it resulted in a endless loop with:
> [0x14591f8] main audio output warning: playback too late (351792):
> [0x14591f8] main audio output warning: playback way too late (352176):
Being constantly too late can mean two things:
- The maths are wrong.
- The latency is excessive or decoded audio buffers are too short
(two sides of the same coin).
> AFAIU, the initial start delay (350ms) triggers corrections, and
> this is what I try to avoid.
Setting up DMA should not take 350ms. But if it really does, then you need
to drop samples otherwise VLC will never achieve lip synchronization.
>> > - *delay = (mtime_t)sys->delay * CLOCK_FREQ / sys->rate;
>> > + *delay = (mtime_t)sys->delay * CLOCK_FREQ / sys->rate +
>> > + sys->init_time - sys->start_time;
>> Normally, delay interpolation should be more accurate using the current
>> time and the time of the last position update rather than the
>> initialization time and first update time...
> oh, this is not to interpolate the current hw time.
That is the only way to synchronize audio though...
> This is to
> "lie", reporting a constant time shift (init_time - start_time),
> equal to the time DMA took to actually start. This is to avoid
> triggering corrections systematically.
If you do not care about synchronization. You might just as well make
TimeGet() return always -1 to the same effects.
Sent from my collocated server
More information about the vlc-devel