struct ast_tranlator_pvt *tr;
};
-static pthread_mutex_t formatlock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t formatlock = AST_MUTEX_INITIALIZER;
static struct ast_format *formats = NULL;
res = ast_sched_wait(c->sched);
if (res < 0) {
ast_closestream(c->stream);
- return 0;
+ break;
}
res = ast_waitfor(c, res);
if (res < 0) {
switch(fr->frametype) {
case AST_FRAME_DTMF:
res = fr->subclass;
- ast_frfree(fr);
- if (strchr(breakon, res))
+ if (strchr(breakon, res)) {
+ ast_frfree(fr);
return res;
+ }
break;
case AST_FRAME_CONTROL:
switch(fr->subclass) {
default:
ast_log(LOG_WARNING, "Unexpected control subclass '%d'\n", fr->subclass);
}
- default:
- /* Ignore */
- ast_frfree(fr);
}
+ /* Ignore */
+ ast_frfree(fr);
} else
ast_sched_runq(c->sched);
}
- return 0;
+ return (c->softhangup ? -1 : 0);
}