There is an issue where the interaction between cainteoir-engine, espeak and mbrola causes the process to hang when:
reading with an mbrola voice through espeak
stopping the current reading instance before it is complete
reading with an mbrola voice again through espeak [NOTE: no sound is generated here]
stopping the current reading instance before it is complete [NOTE: this is where the process hangs]
This can be seen through cainteoir-gtk.
At step [3] the speak_tts_thread thread (in src\libcainteoir\tts\engines.cpp) is actually hung in the speak->engine->speak call. Thus when pthread_join is called in step [4], the process itself hangs (joining on a hung thread).
Changing espeak_tts_callback in src\libcainteoir\tts\espeak.cpp to do:
if (callback->state() == tts::stopped) return 0;
instead of:
if (callback->state() == tts::stopped) return 1;
fixes the issue.
The real issue therefore is with espeak not correctly cleaning up the mbrola instance (which is a forked process) if the callback returns 1 to terminate the synthesis. Returning 0 here is not acceptable as it does not stop espeak and can cause a long delay (e.g. when speaking a large text document or <pre> element).
There is an issue where the interaction between cainteoir-engine, espeak and mbrola causes the process to hang when:
This can be seen through cainteoir-gtk.
At step [3] the
speak_tts_thread
thread (insrc\libcainteoir\tts\engines.cpp
) is actually hung in thespeak->engine->speak
call. Thus whenpthread_join
is called in step [4], the process itself hangs (joining on a hung thread).Changing
espeak_tts_callback
insrc\libcainteoir\tts\espeak.cpp
to do:instead of:
fixes the issue.
The real issue therefore is with espeak not correctly cleaning up the mbrola instance (which is a forked process) if the callback returns 1 to terminate the synthesis. Returning 0 here is not acceptable as it does not stop espeak and can cause a long delay (e.g. when speaking a large text document or
<pre>
element).