]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add an API call that initializes an RTP structure. We need this because chan_sip...
authorJoshua Colp <jcolp@digium.com>
Tue, 26 Dec 2006 04:31:58 +0000 (04:31 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 26 Dec 2006 04:31:58 +0000 (04:31 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@48964 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
include/asterisk/rtp.h
main/rtp.c

index 0256cb6c532108396f299e46adfb7e4cdf34de9a..d99f82760ba3d997252d4e4ee523e9a80800a65a 100644 (file)
@@ -4696,10 +4696,12 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
        /* 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 */
index c0b3d4cfb281b89d04354e77865a3d70917a6672..f6f26e942b2249be6c7923a242613b6954e4dbaa 100644 (file)
@@ -209,6 +209,8 @@ char *ast_rtp_get_quality(struct ast_rtp *rtp);
 /*! \brief Send an H.261 fast update request. Some devices need this rather than the XML message  in SIP */
 int ast_rtcp_send_h261fur(void *data);
 
+void ast_rtp_new_init(struct ast_rtp *rtp);
+
 void ast_rtp_init(void);
 
 int ast_rtp_reload(void);
index 78052d88f79ece718e30f0b96085dd3a535aea35..9b97b7ee3aa696a9d8f763e5fe2398af23ba8a6f 100644 (file)
@@ -1798,6 +1798,23 @@ static struct ast_rtcp *ast_rtcp_new(void)
        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;
@@ -1808,14 +1825,9 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
        if (!(rtp = ast_calloc(1, sizeof(*rtp))))
                return NULL;
 
-       ast_mutex_init(&rtp->bridge_lock);
+       ast_rtp_new_init(rtp);
 
-       rtp->them.sin_family = AF_INET;
-       rtp->us.sin_family = AF_INET;
        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));