package: speech-dispatcher version: 0.7.1-6.2 severity: important tags: upstream
The espeak module of speech-dispatcher leaves the audio open the entire time the module is running. This has amazingly bad consequences for accessibility situations especially with gnome and gdm, although I suspect the problem is broader than that. With raw ALSA, this produces the following problems: 1) speech-dispatcher can no longer speak after suspend or hibernate. This breaks orca until k speech-dispatcher is restarted 2) You use extra power and drain the battery when nothing is speaking. If you happen to use pulseaudio then problems are worse: 3) You cannot use any ALSA only applications or any applications using audio from another user if pulse is run as a user. 4) If pulse crashes, you never get speech back until you kill speech-dispatcher. Based on other bugs I suspect this applies to modules other than espeak, although apparently not the dummy module. I have analyzed src/modules/espeak.c and src/audio/alsa.c. I have not looked at src/audio/pulse.c but based on behavior looks like similar things must be going on there. The device is opened in module initialization and closed in module termination. Only the playback thread appears to interact with the audio device. Alsa_open does some device setup, but most device setup is done in alsa_play. alsa_close doesn't actually appear to close the device. The issue is that the is_open boolean in the spd audio structure is somewhat overloaded. alsa_open|alsa_close assume that it is used to convey whether alsa_close should do anything. However, alsa_play uses it mostly to indicate whether alsa_stop should do anything. When alsa_play is not active, is_open is false, even when the device is open. I can see a few approaches. A) Close the alsa device after each chunk. That's almost certainly going to introduce some artifacts and in the case of pulse probable latency. B) Use sem_timedwait instead of sem_wait in the playback thread. If the timeout expires, call spd_audio_close; call spd_audio_open later. Fix the bugs surrounding alsa_close and any similar bugs in the pulse path. This can be done fairly easily, but is module specific; you'd need to make similar changes to any other modules with the same problem. I'm happy to implement either approach, but want feedback from others before doing so. Thanks, --Sam -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org