summaryrefslogtreecommitdiffstats
path: root/src/modules/alsa/alsa-source.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-24 06:11:42 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-24 06:11:42 +0100
commit3c73025bf52bf7e652f6f8e7ff59b6e10790bdfc (patch)
tree1ff1d8700adf65021b7d2a6eb7745190eca657c2 /src/modules/alsa/alsa-source.c
parentec9f8f10f358ededa1dec0e3f7f57669fce58547 (diff)
in case alsa lies to use don't spin forever
Diffstat (limited to 'src/modules/alsa/alsa-source.c')
-rw-r--r--src/modules/alsa/alsa-source.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index f2dad4c5..ad9a7f29 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -248,6 +248,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
pa_bool_t work_done = FALSE;
pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_record;
+ unsigned j = 0;
pa_assert(u);
pa_source_assert_ref(u->source);
@@ -303,6 +304,14 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
break;
}
+ if (++j > 10) {
+#ifdef DEBUG_TIMING
+ pa_log_debug("Not filling up, because already too many iterations.");
+#endif
+
+ break;
+ }
+
polled = FALSE;
#ifdef DEBUG_TIMING
@@ -381,6 +390,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
int work_done = FALSE;
pa_usec_t max_sleep_usec = 0, process_usec = 0;
size_t left_to_record;
+ unsigned j = 0;
pa_assert(u);
pa_source_assert_ref(u->source);
@@ -424,6 +434,14 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled
break;
}
+ if (++j > 10) {
+#ifdef DEBUG_TIMING
+ pa_log_debug("Not filling up, because already too many iterations.");
+#endif
+
+ break;
+ }
+
polled = FALSE;
for (;;) {