[alsa-devel] Thread safety of snd_pcm_open?
Hello,
I'm having problems using ALSA with LibVLC. The project page http://www.alsa-project.org/main/index.php/SMP_Design claims that the snd_*_open() calls are thread safe, yet it seems that when LibVLC calls them from several threads it can lead to errors like: ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV ALSA lib conf.c:4704:(snd_config_expand) Parse arguments error: No such file or directory ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=NVidia,DEV=0 ALSA lib conf.c:4571:(parse_args) Unknown parameter CARD ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=PCH,DEV=0 ALSA lib conf.c:4687:(snd_config_expand) Unknown parameters CARD=NVidia,DEV=0 ALSA lib conf.c:4571:(parse_args) Unknown parameter DEV (Please see http://mailman.videolan.org/pipermail/vlc-devel/2013-January/091603.html and also http://mailman.videolan.org/pipermail/vlc-devel/2013-January/091633.html for a reproducer on top of LibVLC).
I'm not familiar with the internals of ALSA lib, nor with the internals of LibVLC. The VLC devs claim that they respect the rules regarding ALSA access, but I can't tell for sure...
I'm currently running my reproducer with valgrind, but before I dig too deeply, could you please give some advice?
I have noticed that pcm_direct.c calls getgrnam() which is not reentrant (but replacing it with getgrnam_r is not enough to fix my problem). Also there does not seem to be any locking around snd_pcm_open[_noupdate]. Are those functions supposed to be reentrant?
Thanks for your help,
participants (1)
-
Jérôme Forissier