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/stream.c

    r3664 r3837  
    22212221 
    22222222    status = create_channel( pool, stream, PJMEDIA_DIR_DECODING,  
    2223                              info->fmt.pt, info, &stream->dec); 
     2223                             info->rx_pt, info, &stream->dec); 
    22242224    if (status != PJ_SUCCESS) 
    22252225        goto err_cleanup; 
     
    28352835        return PJMEDIA_EINVALIDPT; 
    28362836 
     2837    /* Get payload type for receiving direction */ 
     2838    si->rx_pt = pt; 
     2839 
    28372840    /* Get codec info. 
    28382841     * For static payload types, get the info from codec manager. 
     
    28942897 
    28952898    } else { 
     2899        pjmedia_codec_id codec_id; 
     2900        pj_str_t codec_id_st; 
     2901        const pjmedia_codec_info *p_info; 
    28962902 
    28972903        attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP,  
     
    29082914        si->fmt.type = si->type; 
    29092915        si->fmt.pt = pj_strtoul(&local_m->desc.fmt[fmti]); 
    2910         pj_strdup(pool, &si->fmt.encoding_name, &rtpmap->enc_name); 
     2916        si->fmt.encoding_name = rtpmap->enc_name; 
    29112917        si->fmt.clock_rate = rtpmap->clock_rate; 
    29122918 
     
    29192925            si->fmt.channel_cnt = 1; 
    29202926        } 
     2927 
     2928        /* Normalize the codec info from codec manager. Note that the 
     2929         * payload type will be resetted to its default (it might have 
     2930         * been rewritten by the SDP negotiator to match to the remote 
     2931         * offer), this is intentional as currently some components may 
     2932         * prefer (or even require) the default PT in codec info. 
     2933         */ 
     2934        pjmedia_codec_info_to_id(&si->fmt, codec_id, sizeof(codec_id)); 
     2935 
     2936        i = 1; 
     2937        codec_id_st = pj_str(codec_id); 
     2938        status = pjmedia_codec_mgr_find_codecs_by_id(mgr, &codec_id_st, 
     2939                                                     &i, &p_info, NULL); 
     2940        if (status != PJ_SUCCESS) 
     2941            return status; 
     2942 
     2943        pj_memcpy(&si->fmt, p_info, sizeof(pjmedia_codec_info)); 
    29212944 
    29222945        /* Determine payload type for outgoing channel, by finding 
     
    29662989 
    29672990    /* Get local fmtp for our decoder. */ 
    2968     pjmedia_stream_info_parse_fmtp(pool, local_m, si->fmt.pt, 
     2991    pjmedia_stream_info_parse_fmtp(pool, local_m, si->rx_pt, 
    29692992                                   &si->param->setting.dec_fmtp); 
    29702993 
Note: See TracChangeset for help on using the changeset viewer.