On Wed, 14 Mar 2018 17:39:46 +0100, Martin Schreiber wrote:
On 03/14/2018 05:16 PM, Takashi Iwai wrote:
Does snd_pcm_close() "scratching off the existing data from the mixed buffer"?
It shouldn't. There is no corresponding code in the dmix close path as far as I read again. So, if it really does anything better, it's somewhere rather in the ALSA timer handling, I suppose.
It does better, see attached alsadrop2.c.
Hm, interesting. Could you track down why it makes difference? For example, put a sleep(10) in snd_pcm_dmix_close() at the beginning, so that it stops processing at the entrance of the close callback. If the sample discard still occurs, something else before that point.
Similarly, move sleep(10) call in each step of snd_pcm_dmix_close() and see what really matters.
Now the question is why? And could it be implemented in snd_pcm_drop() too?
Yes, but only if you understand why it differs :)
Takashi