Author: mjordan
Date: Sat Oct 18 19:49:10 2014
New Revision: 425921

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=425921
Log:
res/res_pjsip_sdp_rtp: Check joint caps when looking to decline outgoing media

When constructing an outgoing media stream for an SDP offer/answer, the current
code checks the override preferences (set by the PJSIP_MEDIA_OFFER function) as
well as what is configured on the endpoint to determine if a codec is available
for the media stream. Unfortunately, this isn't good enough: we must also look
at the negotiated (joint) format capabilities. Otherwise, we'll construct a
media stream offer/answer with no codecs.

Note that this isn't an issue in 13, which already looks at the joint
capabilities thanks to the media re-work done there.

Modified:
    branches/12/res/res_pjsip_sdp_rtp.c

Modified: branches/12/res/res_pjsip_sdp_rtp.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_sdp_rtp.c?view=diff&rev=425921&r1=425920&r2=425921
==============================================================================
--- branches/12/res/res_pjsip_sdp_rtp.c (original)
+++ branches/12/res/res_pjsip_sdp_rtp.c Sat Oct 18 19:49:10 2014
@@ -912,15 +912,14 @@
        struct ast_format format;
        RAII_VAR(struct ast_format_cap *, caps, NULL, ast_format_cap_destroy);
        enum ast_format_type media_type = 
stream_to_media_type(session_media->stream_type);
-
        int direct_media_enabled = 
!ast_sockaddr_isnull(&session_media->direct_media_addr) &&
                !ast_format_cap_is_empty(session->direct_media_cap);
-
        int use_override_prefs = session->override_prefs.formats[0].id;
        struct ast_codec_pref *prefs = use_override_prefs ?
                &session->override_prefs : &session->endpoint->media.prefs;
 
        if ((use_override_prefs && 
!codec_pref_has_type(&session->override_prefs, media_type)) ||
+           (!use_override_prefs && !ast_format_cap_has_type(session->req_caps, 
media_type)) ||
            (!use_override_prefs && 
!ast_format_cap_has_type(session->endpoint->media.codecs, media_type))) {
                /* If no type formats are configured don't add a stream */
                return 0;


-- 
_____________________________________________________________________
-- 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

Reply via email to