Ignore:
Timestamp:
Oct 23, 2011 6:59:48 AM (10 years ago)
Author:
nanang
Message:

Re #1300: Implemented symmetric payload type in generating SDP answer in SDP negotiator.
This should work for all codecs, audio & video. Can be disabled at compile-time
using PJMEDIA_SDP_NEG_REWRITE_ANSWER_PT macro setting.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c

    r3835 r3837  
    17831783    pt = pj_strtoul(&local_m->desc.fmt[0]); 
    17841784 
    1785     /* Get codec info. */ 
    1786     status = pjmedia_vid_codec_mgr_get_codec_info(mgr, pt, &p_info); 
    1787     if (status != PJ_SUCCESS) 
    1788         return status; 
    1789  
    1790     si->codec_info = *p_info; 
    1791  
    17921785    /* Get payload type for receiving direction */ 
    17931786    si->rx_pt = pt; 
    17941787 
    1795     /* Get payload type for transmitting direction */ 
     1788    /* Get codec info and payload type for transmitting direction. */ 
    17961789    if (pt < 96) { 
    1797         /* For static payload type, pt's are symetric */ 
     1790        /* For static payload types, get the codec info from codec manager. */ 
     1791        status = pjmedia_vid_codec_mgr_get_codec_info(mgr, pt, &p_info); 
     1792        if (status != PJ_SUCCESS) 
     1793            return status; 
     1794 
     1795        si->codec_info = *p_info; 
     1796 
     1797        /* Get payload type for transmitting direction. 
     1798         * For static payload type, pt's are symetric. 
     1799         */ 
    17981800        si->tx_pt = pt; 
    1799  
    18001801    } else { 
     1802        const pjmedia_sdp_attr *attr; 
     1803        pjmedia_sdp_rtpmap *rtpmap; 
     1804        pjmedia_codec_id codec_id; 
     1805        pj_str_t codec_id_st; 
    18011806        unsigned i; 
    18021807 
     
    18191824        if (si->tx_pt == 0xFFFF) 
    18201825            return PJMEDIA_EMISSINGRTPMAP; 
     1826 
     1827        /* For dynamic payload types, get codec name from the rtpmap */ 
     1828        attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP,  
     1829                                           &local_m->desc.fmt[0]); 
     1830        if (attr == NULL) 
     1831            return PJMEDIA_EMISSINGRTPMAP; 
     1832 
     1833        status = pjmedia_sdp_attr_to_rtpmap(pool, attr, &rtpmap); 
     1834        if (status != PJ_SUCCESS) 
     1835            return status; 
     1836 
     1837        /* Then get the codec info from the codec manager */ 
     1838        pj_ansi_snprintf(codec_id, sizeof(codec_id), "%.*s/",  
     1839                         rtpmap->enc_name.slen, rtpmap->enc_name.ptr); 
     1840        codec_id_st = pj_str(codec_id); 
     1841        i = 1; 
     1842        status = pjmedia_vid_codec_mgr_find_codecs_by_id(mgr, &codec_id_st, 
     1843                                                         &i, &p_info, NULL); 
     1844        if (status != PJ_SUCCESS) 
     1845            return status; 
     1846 
     1847        si->codec_info = *p_info; 
    18211848    } 
    18221849 
Note: See TracChangeset for help on using the changeset viewer.