[asterisk-commits] file: trunk r48965 - in /trunk: ./ channels/ include/asterisk/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 25 21:34:08 MST 2006


Author: file
Date: Mon Dec 25 22:34:07 2006
New Revision: 48965

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48965
Log:
Merged revisions 48964 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48964 | file | 2006-12-25 23:31:58 -0500 (Mon, 25 Dec 2006) | 2 lines

Add an API call that initializes an RTP structure. We need this because chan_sip is cheeky and uses a temporary RTP structure for codec purposes, and the API calls that are used rely on the lock. (Pointed out on asterisk-dev by Andy Wang)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c
    trunk/include/asterisk/rtp.h
    trunk/main/rtp.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=48965&r1=48964&r2=48965
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Dec 25 22:34:07 2006
@@ -4800,10 +4800,12 @@
 	/* Initialize the temporary RTP structures we use to evaluate the offer from the peer */
 	newaudiortp = alloca(ast_rtp_alloc_size());
 	memset(newaudiortp, 0, ast_rtp_alloc_size());
+	ast_rtp_new_init(newaudiortp);
 	ast_rtp_pt_clear(newaudiortp);
 
 	newvideortp = alloca(ast_rtp_alloc_size());
 	memset(newvideortp, 0, ast_rtp_alloc_size());
+	ast_rtp_new_init(newvideortp);
 	ast_rtp_pt_clear(newvideortp);
 
 	/* Update our last rtprx when we receive an SDP, too */

Modified: trunk/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/rtp.h?view=diff&rev=48965&r1=48964&r2=48965
==============================================================================
--- trunk/include/asterisk/rtp.h (original)
+++ trunk/include/asterisk/rtp.h Mon Dec 25 22:34:07 2006
@@ -223,6 +223,7 @@
 char *ast_rtp_get_quality(struct ast_rtp *rtp);              /*! \brief Return RTCP quality string */
 void ast_rtp_init(void);                                      /*! Initialize RTP subsystem */
 int ast_rtp_reload(void);                                     /*! reload rtp configuration */
+void ast_rtp_new_init(struct ast_rtp *rtp);
 
 /*! Set codec preference */
 int ast_rtp_codec_setpref(struct ast_rtp *rtp, struct ast_codec_pref *prefs);

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?view=diff&rev=48965&r1=48964&r2=48965
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Mon Dec 25 22:34:07 2006
@@ -1860,6 +1860,23 @@
 	return rtcp;
 }
 
+/*!
+ * \brief Initialize a new RTP structure.
+ *
+ */
+void ast_rtp_new_init(struct ast_rtp *rtp)
+{
+	ast_mutex_init(&rtp->bridge_lock);
+
+	rtp->them.sin_family = AF_INET;
+	rtp->us.sin_family = AF_INET;
+	rtp->ssrc = ast_random();
+	rtp->seqno = ast_random() & 0xffff;
+	ast_set_flag(rtp, FLAG_HAS_DTMF);
+
+	return;
+}
+
 struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io_context *io, int rtcpenable, int callbackmode, struct in_addr addr)
 {
 	struct ast_rtp *rtp;
@@ -1870,14 +1887,9 @@
 	if (!(rtp = ast_calloc(1, sizeof(*rtp))))
 		return NULL;
 
-	ast_mutex_init(&rtp->bridge_lock);
-
-	rtp->them.sin_family = AF_INET;
-	rtp->us.sin_family = AF_INET;
+	ast_rtp_new_init(rtp);
+
 	rtp->s = rtp_socket();
-	rtp->ssrc = ast_random();
-	rtp->seqno = ast_random() & 0xffff;
-	ast_set_flag(rtp, FLAG_HAS_DTMF);
 	if (rtp->s < 0) {
 		free(rtp);
 		ast_log(LOG_ERROR, "Unable to allocate socket: %s\n", strerror(errno));



More information about the asterisk-commits mailing list