[Asterisk-cvs] asterisk/channels chan_sip.c,1.328,1.329

markster at lists.digium.com markster at lists.digium.com
Sun Apr 4 17:54:46 CDT 2004


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

Modified Files:
	chan_sip.c 
Log Message:
Various video fixes (bug #688)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- chan_sip.c	4 Apr 2004 21:09:22 -0000	1.328
+++ chan_sip.c	4 Apr 2004 21:54:38 -0000	1.329
@@ -59,6 +59,7 @@
 #include <mysql/mysql.h>
 #endif
 
+#define VIDEO_CODEC_MASK        0x1fc0000 // Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO
 #ifndef IPTOS_MINCOST
 #define IPTOS_MINCOST 0x02
 #endif
@@ -2058,10 +2059,12 @@
 				while(*codecs && (*codecs < 33)) codecs++;
 			}
 		}
+		if (p->vrtp)
+			ast_rtp_pt_clear(p->vrtp);  // Must be cleared in case no m=video line exists
+
 		if (p->vrtp && (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
 			vportno = x;
 			// Scan through the RTP payload types specified in a "m=" line:
-			ast_rtp_pt_clear(p->vrtp);
 			codecs = m + len;
 			while(strlen(codecs)) {
 				if (sscanf(codecs, "%d%n", &codec, &len) != 1) {
@@ -2781,7 +2784,7 @@
 	if ((sizeof(m) <= strlen(m) - 2) || (sizeof(m2) <= strlen(m2) - 2) || (sizeof(a) == strlen(a)) || (sizeof(a2) == strlen(a2)))
 		ast_log(LOG_WARNING, "SIP SDP may be truncated due to undersized buffer!!\n");
 	len = strlen(v) + strlen(s) + strlen(o) + strlen(c) + strlen(t) + strlen(m) + strlen(a);
-	if (p->vrtp)
+	if ((p->vrtp) && (p->jointcapability & VIDEO_CODEC_MASK)) // only if video response is appropriate
 		len += strlen(m2) + strlen(a2);
 	snprintf(costr, sizeof(costr), "%d", len);
 	add_header(resp, "Content-Type", "application/sdp");
@@ -2793,7 +2796,7 @@
 	add_line(resp, t);
 	add_line(resp, m);
 	add_line(resp, a);
-	if (p->vrtp) {
+	if ((p->vrtp) && (p->jointcapability & VIDEO_CODEC_MASK)) { // only if video response is appropriate
 		add_line(resp, m2);
 		add_line(resp, a2);
 	}




More information about the svn-commits mailing list