On Thursday 15 March 2018 17:30:59 fredvs wrote: > Hello Martin. > > Do you have plan to commit your workaround: > http://mailman.alsa-project.org/pipermail/alsa-devel/2018-March/133327.html > > into > > https://gitlab.com/mseide-msegui/pcaudiolib > That is not my workaround but the wokaround the original pcaudiolib for eSpeakNG uses. The Workaround crashes a running write operation in another thread. Do you remember the problem with my sine generator demo? I am sure you will find a situation where there is no crash but for me that is no argument that such a workaround should be used.
What must be done now is to find out why the workaround works, and how to implement the same behavior in snd_pcm_drop(). Takashi writes: " > 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. > If yes, how could the workaround be made without letting crash > pending write operations in separate thread? Likely no, but please test whether it really makes difference before the final conclusion. If yes, it's worth for further investigation. There can be something I overlooked or forgot, of course, it's a damn old code :) " mse: " It does better, see attached alsadrop2.c. Now the question is why? And could it be implemented in snd_pcm_drop() too? " Takashi: " > 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 :) " mse: " > Hm, interesting. Could you track down why it makes difference? Difficult for me because I have no clue about Alsa internals. I hope that Fred van Stappen helps out, he is a big Alsa fan. :-) " Martin ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ mseide-msegui-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

