Hi,
On Wed, 31 Jul 2013, Jaroslav Kysela wrote:
E: The alsa core could detect that condition and solve it equivalent to solution D
I think that´s the proper solution.
Did I miss something or do you agree?
Please, see snd_pcm_sw_params_set_silence_threshold() / snd_pcm_sw_params_set_silence_size() .
thanks Knut for investigating this.
Ecasound started to use snd_pcm_drain() fairly recently (in 2.8.0) and as discovered by Knut, the usage was not quite correct. Drain was run with same settings as normal playback (stop_threshold==buffer_size, silence threshold set to disabled), and this caused issues with drain as stale data sometimes got out at the end.
We now resolved the issue with following code (run at the end of playback):
snd_pcm_sw_params_set_silence_threshold(handle, params, 0); snd_pcm_sw_params_set_silence_size(handle, params, boundary); snd_pcm_sw_params(handle, params); snd_pcm_drain(handle); /* in blocking mode */
... now this does what I was mistakenly assuming snd_pcm_drain() would do implicitly.
This seems a bit complicated from API usage point of view (reconfiguring sw-params for drain), but OTOH is aligned with the rest of the API. As app has full control over sw-params, I can imagine that it would be suprising as well if snd_pcm_drain() would change sw_params under the hood (even if convenient).