summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamr7 <samr7@126591fb-c623-4b62-a76d-97a8e4f34109>2008-11-28 10:06:13 +0000
committersamr7 <samr7@126591fb-c623-4b62-a76d-97a8e4f34109>2008-11-28 10:06:13 +0000
commitbee89eacfc705bab4032590b06662581345a7847 (patch)
tree305c7d8b7a5061f342e1b81b81a1e7a611a7bce8
parent4ec6f05e6a377e7fdf9c2f70ee49501f470f4e02 (diff)
downloadnohands-bee89eacfc705bab4032590b06662581345a7847.tar.gz
Add diagnostics to catch unexpected blocking in some alsa-lib calls.
git-svn-id: http://nohands.svn.sourceforge.net/svnroot/nohands/trunk@45 126591fb-c623-4b62-a76d-97a8e4f34109
-rw-r--r--libhfp/soundio-alsa.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libhfp/soundio-alsa.cpp b/libhfp/soundio-alsa.cpp
index dfc2f78..3211079 100644
--- a/libhfp/soundio-alsa.cpp
+++ b/libhfp/soundio-alsa.cpp
@@ -33,6 +33,8 @@
#include <alsa/asoundlib.h>
#endif
+#include "oplatency.h"
+
/*
* ALSA backend SoundIo implementation, including support for procedural
* and mmap access.
@@ -363,6 +365,7 @@ public:
bool SetAvailMin(snd_pcm_t *pcmp, snd_pcm_uframes_t amin) {
int err;
snd_pcm_sw_params_t *swp;
+ OpLatencyMonitor lat(m_ei, "ALSA SetAvailMin");
snd_pcm_sw_params_alloca(&swp);
@@ -665,6 +668,7 @@ public:
struct pollfd *pollfds;
unsigned short revents;
int ndesc = 0, nused = 0, play_first;
+ OpLatencyMonitor lat(m_ei, "ALSA CheckNotifications");
if (m_rec_handle)
ndesc = snd_pcm_poll_descriptors_count(m_rec_handle);
@@ -875,6 +879,8 @@ public:
snd_pcm_sframes_t err, exp;
if (m_alsa.m_play_handle) {
+ OpLatencyMonitor lat(m_alsa.m_ei,
+ "ALSA get playback queue state");
(void) snd_pcm_avail_update(m_alsa.m_play_handle);
err = snd_pcm_delay(m_alsa.m_play_handle, &exp);
if (err < 0) {
@@ -894,6 +900,7 @@ public:
uint8_t *buf;
snd_pcm_sframes_t exp, err;
ErrorInfo error;
+ OpLatencyMonitor lat(m_alsa.m_ei, "ALSA SndPushInput");
if (m_abort)
return; /* Don't bother */
@@ -956,6 +963,7 @@ public:
uint8_t *buf;
ssize_t err;
ErrorInfo error;
+ OpLatencyMonitor lat(m_alsa.m_ei, "ALSA SndPushOutput");
if (m_abort)
return; /* Don't bother */
@@ -1012,6 +1020,7 @@ public:
bool overrun = false, underrun = false;
int err;
snd_pcm_sframes_t exp = 0;
+ OpLatencyMonitor olat(m_alsa.m_ei, "ALSA async overall");
/*
* We will explicitly test for xruns here.
@@ -1051,6 +1060,8 @@ public:
}
if (m_alsa.m_play_async) {
+ OpLatencyMonitor lat(m_alsa.m_ei,
+ "ALSA check playback");
(void) snd_pcm_avail_update(m_alsa.m_play_handle);
underrun = m_alsa.m_play_xrun;
m_alsa.m_play_xrun = false;