[asterisk-commits] trunk - r7542 /trunk/apps/app_meetme.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 20 04:26:55 CST 2005


Author: markster
Date: Tue Dec 20 04:26:53 2005
New Revision: 7542

URL: http://svn.digium.com/view/asterisk?rev=7542&view=rev
Log:
Fix choppy audio with > 20ms audio frames (bug #5697)

Modified:
    trunk/apps/app_meetme.c

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?rev=7542&r1=7541&r2=7542&view=diff
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Tue Dec 20 04:26:53 2005
@@ -263,14 +263,17 @@
 		return "(not talking)";
 }
 
-static int careful_write(int fd, unsigned char *data, int len)
+static int careful_write(int fd, unsigned char *data, int len, int block)
 {
 	int res;
 	int x;
 
 	while (len) {
-		x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
-		res = ioctl(fd, ZT_IOMUX, &x);
+		if (block) {
+			x = ZT_IOMUX_WRITE | ZT_IOMUX_SIGEVENT;
+			res = ioctl(fd, ZT_IOMUX, &x);
+		} else
+			res = 0;
 		if (res >= 0)
 			res = write(fd, data, len);
 		if (res < 1) {
@@ -423,7 +426,7 @@
 		len = 0;
 	}
 	if (data) 
-		careful_write(conf->fd, data, len);
+		careful_write(conf->fd, data, len, 1);
 
 	ast_mutex_unlock(&conflock);
 
@@ -1308,7 +1311,11 @@
 						   audio frames (in which case carefully writing would only
 						   have delayed the audio even further).
 						*/
-						write(fd, f->data, f->datalen);
+						/* As it turns out, we do want to use careful write.  We just
+						   don't want to block, but we do want to at least *try*
+						   to write out all the samples.
+						 */
+						careful_write(fd, f->data, f->datalen, 0);
 					}
 				} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
 					char tmp[2];



More information about the asterisk-commits mailing list