summaryrefslogtreecommitdiffstats
path: root/src/simple.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-07-09 23:26:10 +0000
committerLennart Poettering <lennart@poettering.net>2004-07-09 23:26:10 +0000
commitcffc7768bd5b8d16308c15102b4d03d08d287098 (patch)
tree389f6035e787b8e2106862d77718cc9dc4f140b6 /src/simple.c
parent863fb90d90c2e57e60a0f5b81e0847319399b8ed (diff)
fix recording for simpel and esound protocols
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@54 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/simple.c')
-rw-r--r--src/simple.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/simple.c b/src/simple.c
index 50bfea43..ba0a8f0c 100644
--- a/src/simple.c
+++ b/src/simple.c
@@ -14,24 +14,37 @@ struct pa_simple {
int dead, drained;
};
+static int check_error(struct pa_simple *p, int *perror) {
+ assert(p);
+
+ if (pa_context_is_dead(p->context) || (p->stream && pa_stream_is_dead(p->stream))) {
+ if (perror)
+ *perror = pa_context_errno(p->context);
+ return -1;
+ }
+
+ return 0;
+}
+
static int iterate(struct pa_simple *p, int block, int *perror) {
assert(p && p->context && p->mainloop);
+ if (check_error(p, perror) < 0)
+ return -1;
+
if (!block && !pa_context_is_pending(p->context))
return 0;
-
+
do {
- if (pa_context_is_dead(p->context) || (p->stream && pa_stream_is_dead(p->stream))) {
- if (perror)
- *perror = pa_context_errno(p->context);
- return -1;
- }
-
if (pa_mainloop_iterate(p->mainloop, 1, NULL) < 0) {
if (perror)
*perror = PA_ERROR_INTERNAL;
return -1;
}
+
+ if (check_error(p, perror) < 0)
+ return -1;
+
} while (pa_context_is_pending(p->context));
return 0;