fix recording for simpel and esound protocols

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@54 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-07-09 23:26:10 +00:00
parent 863fb90d90
commit cffc7768bd
22 changed files with 480 additions and 176 deletions

View file

@ -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;