[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/arts/flow
From:       Allan Sandfeld Jensen <kde () carewolf ! com>
Date:       2005-06-07 16:01:01
Message-ID: 1118160061.961168.17657.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 423127 by carewolf:

Commiting fix for checking xrun in pcm_avail_update. 
Commited based on user feedback as I do not have 64bit system.
BUG: 88474, 106569


 M  +27 -2     audioioalsa9.cc  


--- trunk/KDE/arts/flow/audioioalsa9.cc #423126:423127
@@ -260,15 +260,40 @@
 
 int AudioIOALSA::getParam(AudioParam p)
 {
+	snd_pcm_sframes_t avail;
 	switch(p) {
 
         case canRead:
 		if (! m_pcm_capture) return -1;
-		return snd_pcm_frames_to_bytes(m_pcm_capture, snd_pcm_avail_update(m_pcm_capture));
+		while ((avail = snd_pcm_avail_update(m_pcm_capture)) < 0) {
+			if (avail == -EPIPE)
+				avail = xrun(m_pcm_capture);
+#ifdef HAVE_SND_PCM_RESUME
+			else if (avail == -ESTRPIPE)
+				avail = resume(m_pcm_capture);
+#endif
+			if (avail < 0) {
+				arts_info("Capture error: %s", snd_strerror(avail));
+				return -1;
+			}
+		}
+		return snd_pcm_frames_to_bytes(m_pcm_capture, avail);
 
 	case canWrite:
 		if (! m_pcm_playback) return -1;
-		return snd_pcm_frames_to_bytes(m_pcm_playback, snd_pcm_avail_update(m_pcm_playback));
+		while ((avail = snd_pcm_avail_update(m_pcm_playback)) < 0) {
+			if (avail == -EPIPE)
+				avail = xrun(m_pcm_playback);
+#ifdef HAVE_SND_PCM_RESUME
+			else if (avail == -ESTRPIPE)
+				avail = resume(m_pcm_playback);
+#endif
+			if (avail < 0) {
+				arts_info("Playback error: %s", snd_strerror(avail));
+				return -1;
+			}
+		}
+		return snd_pcm_frames_to_bytes(m_pcm_playback, avail);
 
 	case selectReadFD:
 		return -1;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic