Changeset 290 for pjproject/trunk/pjmedia/src/pjmedia/session.c
- Timestamp:
- Mar 6, 2006 1:30:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/session.c
r276 r290 96 96 97 97 si->type = PJMEDIA_TYPE_UNKNOWN; 98 98 return PJMEDIA_EINVALIMEDIATYPE; 99 99 } 100 100 … … 142 142 143 143 /* And codec must be numeric! */ 144 if (!pj_isdigit(*local_m->desc.fmt[0].ptr)) 144 if (!pj_isdigit(*local_m->desc.fmt[0].ptr) || 145 !pj_isdigit(*rem_m->desc.fmt[0].ptr)) 146 { 145 147 return PJMEDIA_EINVALIDPT; 146 147 /* Get the payload number. */ 148 } 149 150 /* Get the payload number for receive channel. */ 148 151 pt = pj_strtoul(&local_m->desc.fmt[0]); 149 152 … … 162 165 return status; 163 166 167 /* For static payload type, pt's are symetric */ 168 si->tx_pt = pt; 169 164 170 } else { 165 166 171 attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP, 167 172 &local_m->desc.fmt[0]); … … 179 184 pj_strdup(pool, &si->fmt.encoding_name, &rtpmap->enc_name); 180 185 si->fmt.sample_rate = rtpmap->clock_rate; 181 } 186 187 /* Determine payload type for outgoing channel, by finding 188 * dynamic payload type in remote SDP that matches the answer. 189 */ 190 si->tx_pt = 0xFFFF; 191 for (i=0; i<rem_m->desc.fmt_count; ++i) { 192 unsigned rpt; 193 pjmedia_sdp_attr *r_attr; 194 pjmedia_sdp_rtpmap r_rtpmap; 195 196 rpt = pj_strtoul(&rem_m->desc.fmt[i]); 197 if (rpt < 96) 198 continue; 199 200 r_attr = pjmedia_sdp_media_find_attr(rem_m, &ID_RTPMAP, 201 &rem_m->desc.fmt[i]); 202 if (!r_attr) 203 continue; 204 205 if (pjmedia_sdp_attr_get_rtpmap(attr, &r_rtpmap) != PJ_SUCCESS) 206 continue; 207 208 if (!pj_stricmp(&rtpmap->enc_name, &r_rtpmap.enc_name) && 209 rtpmap->clock_rate == r_rtpmap.clock_rate) 210 { 211 /* Found matched codec. */ 212 si->tx_pt = rpt; 213 break; 214 } 215 } 216 217 if (si->tx_pt == 0xFFFF) 218 return PJMEDIA_EMISSINGRTPMAP; 219 } 220 221 182 222 183 223 /* Get local DTMF payload type */
Note: See TracChangeset
for help on using the changeset viewer.