summaryrefslogtreecommitdiff
path: root/res/res_pjsip_session.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2014-09-27 17:29:05 +0000
committerJoshua Colp <jcolp@digium.com>2014-09-27 17:29:05 +0000
commit2eef53c465460609cd66770b5dcdcb17a20fc33e (patch)
tree1ca5c42dbd7d1daf7febbbe2bb1628a6613b454c /res/res_pjsip_session.c
parent76744543b4dc49c57c4c48647bfec23cd9f3f911 (diff)
res_pjsip_session: Reduce SDP size by removing duplicate connection lines.
Due to the architecture of how media streams are handled each individual handler adds connection details (IP address) for it. The first media stream is then used as the top level SDP connection line. In practice each line ends up being the same so to reduce the SDP size stream-level connection information is also added to the SDP if it differs from the top level SDP connection line. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r--res/res_pjsip_session.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index c31e4d252..3b924ac2f 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -2132,10 +2132,27 @@ static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, stru
/* Use the connection details of the first media stream if possible for SDP level */
if (local->media_count) {
+ int stream;
+
+ /* Since we are using the first media stream as the SDP level we can get rid of it
+ * from the stream itself
+ */
local->conn = local->media[0]->conn;
+ local->media[0]->conn = NULL;
pj_strassign(&local->origin.net_type, &local->conn->net_type);
pj_strassign(&local->origin.addr_type, &local->conn->addr_type);
pj_strassign(&local->origin.addr, &local->conn->addr);
+
+ /* Go through each media stream seeing if the connection details actually differ,
+ * if not just use SDP level and reduce the SDP size
+ */
+ for (stream = 1; stream < local->media_count; stream++) {
+ if (!pj_strcmp(&local->conn->net_type, &local->media[stream]->conn->net_type) &&
+ !pj_strcmp(&local->conn->addr_type, &local->media[stream]->conn->addr_type) &&
+ !pj_strcmp(&local->conn->addr, &local->media[stream]->conn->addr)) {
+ local->media[stream]->conn = NULL;
+ }
+ }
} else {
local->origin.net_type = STR_IN;
local->origin.addr_type = session->endpoint->media.rtp.ipv6 ? STR_IP6 : STR_IP4;