mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
Backport audio handling loop fixes from trunk version of app_fax.
This backport resolves some issues handling audio frames during FAX processing, and ensures that the FAX application doesn't accidentally get notified of a T.38 switchover at the end of a successful FAX. (closes issue #16127) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@225871 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -492,25 +492,27 @@ static int transmit_audio(fax_session *s)
|
|||||||
while (!s->finished) {
|
while (!s->finished) {
|
||||||
inf = NULL;
|
inf = NULL;
|
||||||
|
|
||||||
if ((res = ast_waitfor(s->chan, 20)) < 0) {
|
if ((res = ast_waitfor(s->chan, 25)) < 0) {
|
||||||
|
ast_debug(1, "Error waiting for a frame\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if nothing arrived, check the watchdog timers */
|
/* Watchdog */
|
||||||
if (res == 0) {
|
now = ast_tvnow();
|
||||||
now = ast_tvnow();
|
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
|
||||||
if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
|
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
|
||||||
ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
|
res = -1;
|
||||||
res = -1;
|
break;
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
/* timers have not triggered, loop around to wait
|
|
||||||
* again
|
|
||||||
*/
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!res) {
|
||||||
|
/* There was timeout waiting for a frame. Loop around and wait again */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* There is a frame available. Get it */
|
||||||
|
res = 0;
|
||||||
|
|
||||||
if (!(inf = ast_read(s->chan))) {
|
if (!(inf = ast_read(s->chan))) {
|
||||||
ast_debug(1, "Channel hangup\n");
|
ast_debug(1, "Channel hangup\n");
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user