Changeset 276
- Timestamp:
- Mar 3, 2006 10:43:08 AM (19 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/codec.h
r242 r276 414 414 415 415 /** 416 * Get codec info for the specified static payload type. 417 * 418 * @param mgr The codec manager. 419 * @param pt Static payload type/number. 420 * @param inf Pointer to receive codec info. 421 * 422 * @return PJ_SUCCESS on success. 423 */ 424 PJ_DECL(pj_status_t) pjmedia_codec_mgr_get_codec_info(pjmedia_codec_mgr *mgr, 425 unsigned pt, 426 pjmedia_codec_info *inf); 427 428 /** 416 429 * Get default codec param for the specified codec info. 417 430 * -
pjproject/trunk/pjmedia/src/pjmedia/codec.c
r176 r276 118 118 119 119 /* 120 * Get codec info for static payload type. 121 */ 122 PJ_DEF(pj_status_t) pjmedia_codec_mgr_get_codec_info(pjmedia_codec_mgr *mgr, 123 unsigned pt, 124 pjmedia_codec_info *inf) 125 { 126 unsigned i; 127 128 PJ_ASSERT_RETURN(mgr && inf && pt>=0 && pt < 96, PJ_EINVAL); 129 130 for (i=0; i<mgr->codec_cnt; ++i) { 131 if (mgr->codecs[i].pt == pt) { 132 pj_memcpy(inf, &mgr->codecs[i], sizeof(pjmedia_codec_info)); 133 return PJ_SUCCESS; 134 } 135 } 136 137 return PJMEDIA_CODEC_EUNSUP; 138 } 139 140 /* 120 141 * Allocate one codec. 121 142 */ -
pjproject/trunk/pjmedia/src/pjmedia/session.c
r225 r276 61 61 */ 62 62 static pj_status_t create_stream_info_from_sdp(pj_pool_t *pool, 63 pjmedia_endpt *endpt, 63 64 pjmedia_stream_info *si, 64 65 const pjmedia_sdp_conn *local_conn, … … 69 70 const pjmedia_sdp_attr *attr; 70 71 pjmedia_sdp_rtpmap *rtpmap; 71 unsigned i ;72 unsigned i, pt; 72 73 pj_status_t status; 73 74 … … 144 145 return PJMEDIA_EINVALIDPT; 145 146 146 /* Find rtpmap for the first codec. 147 * For this version of PJMEDIA, we do not support static payload 148 * type without rtpmap. 147 /* Get the payload number. */ 148 pt = pj_strtoul(&local_m->desc.fmt[0]); 149 150 /* Get codec info. 151 * For static payload types, get the info from codec manager. 152 * For dynamic payload types, MUST get the rtpmap. 149 153 */ 150 attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP, 151 &local_m->desc.fmt[0]); 152 if (attr == NULL) 153 return PJMEDIA_EMISSINGRTPMAP; 154 155 status = pjmedia_sdp_attr_to_rtpmap(pool, attr, &rtpmap); 156 if (status != PJ_SUCCESS) 157 return status; 158 159 /* Build codec format info: */ 160 161 si->fmt.type = si->type; 162 si->fmt.pt = pj_strtoul(&local_m->desc.fmt[0]); 163 pj_strdup(pool, &si->fmt.encoding_name, &rtpmap->enc_name); 164 si->fmt.sample_rate = rtpmap->clock_rate; 154 if (pt < 96) { 155 156 pjmedia_codec_mgr *mgr; 157 158 mgr = pjmedia_endpt_get_codec_mgr(endpt); 159 160 status = pjmedia_codec_mgr_get_codec_info( mgr, pt, &si->fmt); 161 if (status != PJ_SUCCESS) 162 return status; 163 164 } else { 165 166 attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP, 167 &local_m->desc.fmt[0]); 168 if (attr == NULL) 169 return PJMEDIA_EMISSINGRTPMAP; 170 171 status = pjmedia_sdp_attr_to_rtpmap(pool, attr, &rtpmap); 172 if (status != PJ_SUCCESS) 173 return status; 174 175 /* Build codec format info: */ 176 177 si->fmt.type = si->type; 178 si->fmt.pt = pj_strtoul(&local_m->desc.fmt[0]); 179 pj_strdup(pool, &si->fmt.encoding_name, &rtpmap->enc_name); 180 si->fmt.sample_rate = rtpmap->clock_rate; 181 } 165 182 166 183 /* Get local DTMF payload type */ … … 255 272 rem_conn = rem_m->conn ? rem_m->conn : rem_sdp->conn; 256 273 257 status = create_stream_info_from_sdp(session->pool, si,274 status = create_stream_info_from_sdp(session->pool, endpt, si, 258 275 local_conn, rem_conn, 259 276 local_m, rem_m);
Note: See TracChangeset
for help on using the changeset viewer.