File kdeaccessibility3-alsa-waitforcompletion.patch of Package kdeaccessibility3
diff -Naru kdeaccessibility-3.5.10_orig/kttsd/players/alsaplayer/alsaplayer.cpp kdeaccessibility-3.5.10/kttsd/players/alsaplayer/alsaplayer.cpp
--- kdeaccessibility-3.5.10_orig/kttsd/players/alsaplayer/alsaplayer.cpp 2007-10-08 18:47:18.000000000 +0900
+++ kdeaccessibility-3.5.10/kttsd/players/alsaplayer/alsaplayer.cpp 2018-12-05 15:28:42.171608199 +0900
@@ -1514,6 +1514,11 @@
if (m_debugLevel >= 1) header(rtype, name);
set_params();
+ if ((r = snd_pcm_wait(handle, 10000)) != 1) {
+ ERR("PCM was not ready, playback aborted: %d", r);
+ return;
+ }
+
while (loaded > chunk_bytes && written < count) {
if (pcm_write(audiobuf + written, chunk_size) <= 0)
return;
@@ -1556,6 +1561,7 @@
}
DBG("Draining...");
+ snd_pcm_drain(handle);
/* We want the next "device ready" notification only when the buffer is completely empty. */
/* Do this by setting the avail_min to the buffer size. */