[Asterisk-cvs] asterisk/channels chan_vpb.c,1.99,1.100

bkramer bkramer
Tue Nov 1 20:10:06 CST 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv17912

Modified Files:
	chan_vpb.c 
Log Message:
 working on delay issue when bridging via ast_bridge


Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- chan_vpb.c	1 Nov 2005 23:20:46 -0000	1.99
+++ chan_vpb.c	2 Nov 2005 01:02:02 -0000	1.100
@@ -2281,11 +2281,16 @@
 		if(option_verbose>1) {
 			ast_verbose("%s: vpb_write: Starting play mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(frame->subclass));
 		}
+		p->lastoutput = fmt;
+		ast_mutex_unlock(&p->play_lock);
+		return 0;
 	} else if (p->lastoutput != fmt) {
 		vpb_play_buf_finish(p->handle);
 		vpb_play_buf_start(p->handle, fmt);
 		if(option_verbose>1) 
 			ast_verbose("%s: vpb_write: Changed play format (%d=>%d)\n",p->dev,p->lastoutput,fmt);
+		ast_mutex_unlock(&p->play_lock);
+		return 0;
 	}
 	p->lastoutput = fmt;
 
@@ -2304,6 +2309,12 @@
 			short * data = (short*)frame->data;
 			ast_verbose("%s: vpb_write: Wrote chan (codec=%d) %d %d\n", p->dev, fmt, data[0],data[1]);
 		}
+		else {
+			ast_log(LOG_DEBUG, "%s: vpb_write: cant write to card, restarting buffer\n", p->dev);
+			vpb_play_buf_start(p->handle, p->lastoutput);
+			ast_mutex_unlock(&p->play_lock);
+			return 0;
+		}
 		p->play_buf_time = ast_tvdiff_ms(ast_tvnow(), play_buf_time_start);
 	}
 	else {
@@ -2453,15 +2464,18 @@
 		if (p->lastinput == -1) {
 			vpb_record_buf_start(p->handle, fmt);
 			vpb_reset_record_fifo_alarm(p->handle);
+			p->lastinput = fmt;
 			if(option_verbose>1) 
 				ast_verbose( VERBOSE_PREFIX_2 "%s: Starting record mode (codec=%d)[%s]\n",p->dev,fmt,ast2vpbformatname(afmt));
+			continue;
 		} else if (p->lastinput != fmt) {
 			vpb_record_buf_finish(p->handle);
 			vpb_record_buf_start(p->handle, fmt);
+			p->lastinput = fmt;
 			if(option_verbose>1) 
 				ast_verbose( VERBOSE_PREFIX_2 "%s: Changed record format (%d=>%d)\n",p->dev,p->lastinput,fmt);
+			continue;
 		}
-		p->lastinput = fmt;
 
 		/* Read only if up and not bridged, or a bridge for which we can read. */
 		if (option_verbose > 5) {




More information about the svn-commits mailing list