[vlc-devel] [WIP PATCH] audiotrack: improve perfs, make it asynchronous
Rémi Denis-Courmont
remi at remlab.net
Fri Feb 13 18:25:45 CET 2015
Le vendredi 13 février 2015, 17:36:10 Thomas Guillem a écrit :
> Previously, the module waited for the buffer to be fully written, therefore
> p_aout->play function took too much times.
There is no such thing as play taking too much time. Decoding audio samples
before they can be queued to the underlying audio output has no advantages,
and one disadvantage: it increases the latency of audio filters.
> Now, the module send all buffers in a queue and don't wait for them.
I believe there is a bug in the ES output buffering code, where slow audio
interferes with video. That is not an issue with the Android audio output.
> AudioTrack delay is now set by JNIThread when a buffer is written.
I can play audio on PulseAudio or ALSA with 2 seconds advance with no problems
quality or stability whatsoever. This is currently the somewhat arbitrary
maximum enforced by the decoder thread, and it can easily be triggered by
increasing caching above 2000 ms.
Assuming that the audio output can do it, that is more stable and could enable
better power efficiency by increasing the audio period duration. The only issue
is the unbearable latency when live-tuning the audio filters, as mentioned
above. PulseAudio, and some but not all ALSA drivers, support this. I gather
that your target does not.
> [7a7ec2f4] core audio output: playback too late (60664): up-sampling
> [7a7ec2f4] core audio output: resampling stopped (drift: -393 us)
> [7a7ec2f4] core audio output: playback too late (63506): up-sampling
> [7a7ec2f4] core audio output: resampling stopped (drift: -12040 us)
> [7a7ec2f4] core audio output: playback too late (67178): up-sampling
> [7a7ec2f4] core audio output: resampling stopped (drift: -4072 us)
This rather looks like the audio buffer is too short rather than too long.
Or the computation in TimeGet() is off.
> I think it's caused by a too big delay.
Don´t do that then. Let play() sleep when it needs to.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list