[asterisk-commits] kpfleming: branch 1.6.2 r225871 - /branches/1.6.2/apps/app_fax.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 26 10:56:12 CDT 2009


Author: kpfleming
Date: Mon Oct 26 10:56:08 2009
New Revision: 225871

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=225871
Log:
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)

Modified:
    branches/1.6.2/apps/app_fax.c

Modified: branches/1.6.2/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/apps/app_fax.c?view=diff&rev=225871&r1=225870&r2=225871
==============================================================================
--- branches/1.6.2/apps/app_fax.c (original)
+++ branches/1.6.2/apps/app_fax.c Mon Oct 26 10:56:08 2009
@@ -492,24 +492,26 @@
 	while (!s->finished) {
 		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;
 		}
 
-		/* if nothing arrived, check the watchdog timers */
-		if (res == 0) {
-			now = ast_tvnow();
-			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");
-				res = -1;
-				break;
-			} else {
-				/* timers have not triggered, loop around to wait
-				 * again
-				 */
-				continue;
-			}
-		}
+		/* Watchdog */
+		now = ast_tvnow();
+		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");
+			res = -1;
+			break;
+		}
+
+		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))) {
 			ast_debug(1, "Channel hangup\n");




More information about the asterisk-commits mailing list