[asterisk-commits] oej: branch oej/teapot-1.8 r412069 - in /team/oej/teapot-1.8: patches/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 10 04:20:43 CDT 2014


Author: oej
Date: Thu Apr 10 04:20:34 2014
New Revision: 412069

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412069
Log:
handling the case where a=rtcp is processed before rtp address is actually set

Added:
    team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff   (with props)
Modified:
    team/oej/teapot-1.8/res/res_rtp_asterisk.c

Added: team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff?view=auto&rev=412069
==============================================================================
--- team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff (added)
+++ team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff Thu Apr 10 04:20:34 2014
@@ -1,0 +1,37 @@
+Index: res/res_rtp_asterisk.c
+===================================================================
+--- res/res_rtp_asterisk.c	(revision 412061)
++++ res/res_rtp_asterisk.c	(working copy)
+@@ -175,6 +175,8 @@
+ 	struct io_context *io;
+ 	void *data;
+ 	struct ast_rtcp *rtcp;
++	unsigned int rtcpport;		/*!< temporary storage for a=rtcp */
++
+ 	struct ast_rtp *bridged;        /*!< Who we are Packet bridged to */
+ 
+ 	enum strict_rtp_state strict_rtp_state; /*!< Current state that strict RTP protection is in */
+@@ -2605,7 +2607,10 @@
+ 	if (rtp->rtcp) {
+ 		ast_debug(1, "Setting RTCP address on RTP instance '%p'\n", instance);
+ 		ast_sockaddr_copy(&rtp->rtcp->them, addr);
+-		if (!ast_sockaddr_isnull(addr)) {
++		if (rtp->rtcpport) {
++			/* Port was set with a=rtcp in sdp */
++			ast_sockaddr_set_port(&rtp->rtcp->them, rtp->rtcpport);
++		} if (!ast_sockaddr_isnull(addr)) {
+ 			ast_sockaddr_set_port(&rtp->rtcp->them,
+ 					      ast_sockaddr_port(addr) + 1);
+ 		}
+@@ -2624,6 +2629,11 @@
+ static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port)
+ {
+ 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
++	if (!rtp->rtcp) {
++		/* We have no rtcp active yet. */
++		rtp->rtcpport = port;
++		return;
++	}
+ 	if (!ast_sockaddr_isnull(&rtp->rtcp->them)) {
+ 		ast_sockaddr_set_port(&rtp->rtcp->them, port);
+ 		ast_debug(1, "Setting RTCP port on RTP instance '%p' to %d\n", instance, port);

Propchange: team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/oej/teapot-1.8/patches/blackberry-update-rtcp-port-sdp.diff
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/oej/teapot-1.8/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/teapot-1.8/res/res_rtp_asterisk.c?view=diff&rev=412069&r1=412068&r2=412069
==============================================================================
--- team/oej/teapot-1.8/res/res_rtp_asterisk.c (original)
+++ team/oej/teapot-1.8/res/res_rtp_asterisk.c Thu Apr 10 04:20:34 2014
@@ -206,6 +206,8 @@
 	struct io_context *io;
 	void *data;
 	struct ast_rtcp *rtcp;
+	unsigned int rtcpport;		/*!< temporary storage for a=rtcp */
+
 	struct ast_rtp *bridged;        /*!< Who we are Packet bridged to */
 
 	enum strict_rtp_state strict_rtp_state; /*!< Current state that strict RTP protection is in */
@@ -2984,7 +2986,10 @@
 	if (rtp->rtcp) {
 		ast_debug(1, "Setting RTCP address on RTP instance '%p'\n", instance);
 		ast_sockaddr_copy(&rtp->rtcp->them, addr);
-		if (!ast_sockaddr_isnull(addr)) {
+		if (rtp->rtcpport) {
+			/* Port was set with a=rtcp in sdp */
+			ast_sockaddr_set_port(&rtp->rtcp->them, rtp->rtcpport);
+		} if (!ast_sockaddr_isnull(addr)) {
 			ast_sockaddr_set_port(&rtp->rtcp->them,
 					      ast_sockaddr_port(addr) + 1);
 		}
@@ -3003,6 +3008,11 @@
 static void ast_rtp_remote_rtcp_port_set(struct ast_rtp_instance *instance, unsigned int port)
 {
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+	if (!rtp->rtcp) {
+		/* We have no rtcp active yet. */
+		rtp->rtcpport = port;
+		return;
+	}
 	if (!ast_sockaddr_isnull(&rtp->rtcp->them)) {
 		ast_sockaddr_set_port(&rtp->rtcp->them, port);
 		ast_debug(1, "Setting RTCP port on RTP instance '%p' to %d\n", instance, port);




More information about the asterisk-commits mailing list