Author: file Date: Fri Oct 3 02:54:33 2014 New Revision: 424415 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424415 Log: 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. ........ Merged revisions 424414 from http://svn.asterisk.org/svn/asterisk/branches/12 Modified: branches/13/ (props changed) branches/13/res/res_pjsip_session.c Propchange: branches/13/ ------------------------------------------------------------------------------ Binary property 'branch-12-merged' - no diff available. Modified: branches/13/res/res_pjsip_session.c URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_pjsip_session.c?view=diff&rev=424415&r1=424414&r2=424415 ============================================================================== --- branches/13/res/res_pjsip_session.c (original) +++ branches/13/res/res_pjsip_session.c Fri Oct 3 02:54:33 2014 @@ -2127,10 +2127,27 @@ /* 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; -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
