- Timestamp:
- Apr 3, 2006 10:32:49 PM (19 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/session.h
r215 r374 65 65 pjmedia_stream_info stream_info[PJMEDIA_MAX_SDP_MEDIA]; 66 66 }; 67 68 69 /** 70 * Initialize stream info from SDP media lines. 71 * 72 * @param si Stream info structure to be initialized. 73 * @param pool Pool. 74 * @param endpt Pjmedia endpoint. 75 * @param local Local SDP session descriptor. 76 * @param remote Remote SDP session descriptor. 77 * @param stream_idx Media stream index in the session descriptor. 78 * 79 * @return PJ_SUCCESS if stream info is successfully initialized. 80 */ 81 PJ_DECL(pj_status_t) pjmedia_stream_info_from_sdp( 82 pjmedia_stream_info *si, 83 pj_pool_t *pool, 84 pjmedia_endpt *endpt, 85 const pjmedia_sdp_session *local, 86 const pjmedia_sdp_session *remote, 87 unsigned stream_idx); 67 88 68 89 -
pjproject/trunk/pjmedia/src/pjmedia/session.c
r302 r374 60 60 * Create stream info from SDP media line. 61 61 */ 62 static pj_status_t create_stream_info_from_sdp(pj_pool_t *pool, 63 pjmedia_endpt *endpt,64 pjmedia_stream_info *si,65 const pjmedia_sdp_conn *local_conn,66 const pjmedia_sdp_conn *rem_conn,67 const pjmedia_sdp_media *local_m,68 const pjmedia_sdp_media *rem_m)62 PJ_DEF(pj_status_t) pjmedia_stream_info_from_sdp( 63 pjmedia_stream_info *si, 64 pj_pool_t *pool, 65 pjmedia_endpt *endpt, 66 const pjmedia_sdp_session *local, 67 const pjmedia_sdp_session *remote, 68 unsigned stream_idx) 69 69 { 70 70 const pjmedia_sdp_attr *attr; 71 const pjmedia_sdp_media *local_m; 72 const pjmedia_sdp_media *rem_m; 73 const pjmedia_sdp_conn *local_conn; 74 const pjmedia_sdp_conn *rem_conn; 71 75 pjmedia_sdp_rtpmap *rtpmap; 72 76 unsigned i, pt; … … 74 78 75 79 80 76 81 /* Validate arguments: */ 77 78 PJ_ASSERT_RETURN(pool && si && local_conn && rem_conn && 79 local_m && rem_m, PJ_EINVAL); 82 PJ_ASSERT_RETURN(pool && si && local && remote, PJ_EINVAL); 83 PJ_ASSERT_RETURN(stream_idx < local->media_count, PJ_EINVAL); 84 PJ_ASSERT_RETURN(stream_idx < remote->media_count, PJ_EINVAL); 85 86 87 local_m = local->media[stream_idx]; 88 rem_m = remote->media[stream_idx]; 89 90 local_conn = local_m->conn ? local_m->conn : local->conn; 91 if (local_conn == NULL) 92 return PJMEDIA_SDP_EMISSINGCONN; 93 94 rem_conn = rem_m->conn ? rem_m->conn : remote->conn; 95 if (rem_conn == NULL) 96 return PJMEDIA_SDP_EMISSINGCONN; 97 80 98 81 99 /* Reset: */ … … 156 174 */ 157 175 if (pt < 96) { 158 159 pjmedia_codec_mgr *mgr; 160 161 mgr = pjmedia_endpt_get_codec_mgr(endpt); 162 163 status = pjmedia_codec_mgr_get_codec_info( mgr, pt, &si->fmt); 164 if (status != PJ_SUCCESS) 165 return status; 176 pj_bool_t has_rtpmap; 177 178 rtpmap = NULL; 179 has_rtpmap = PJ_TRUE; 180 181 attr = pjmedia_sdp_media_find_attr(local_m, &ID_RTPMAP, 182 &local_m->desc.fmt[0]); 183 if (attr == NULL) { 184 has_rtpmap = PJ_FALSE; 185 } 186 if (attr != NULL) { 187 status = pjmedia_sdp_attr_to_rtpmap(pool, attr, &rtpmap); 188 if (status != PJ_SUCCESS) 189 has_rtpmap = PJ_FALSE; 190 } 191 192 /* Build codec format info: */ 193 if (has_rtpmap) { 194 si->fmt.type = si->type; 195 si->fmt.pt = pj_strtoul(&local_m->desc.fmt[0]); 196 pj_strdup(pool, &si->fmt.encoding_name, &rtpmap->enc_name); 197 si->fmt.sample_rate = rtpmap->clock_rate; 198 199 } else { 200 pjmedia_codec_mgr *mgr; 201 202 mgr = pjmedia_endpt_get_codec_mgr(endpt); 203 204 status = pjmedia_codec_mgr_get_codec_info( mgr, pt, &si->fmt); 205 if (status != PJ_SUCCESS) 206 return status; 207 } 166 208 167 209 /* For static payload type, pt's are symetric */ … … 304 346 305 347 pjmedia_stream_info *si = &session->stream_info[i]; 306 const pjmedia_sdp_media *local_m = local_sdp->media[i];307 const pjmedia_sdp_media *rem_m = rem_sdp->media[i];308 pjmedia_sdp_conn *local_conn, *rem_conn;309 348 310 349 /* Build stream info based on media line in local SDP */ 311 local_conn = local_m->conn ? local_m->conn : local_sdp->conn; 312 rem_conn = rem_m->conn ? rem_m->conn : rem_sdp->conn; 313 314 status = create_stream_info_from_sdp(session->pool, endpt, si, 315 local_conn, rem_conn, 316 local_m, rem_m); 350 status = pjmedia_stream_info_from_sdp(si, session->pool, endpt, 351 local_sdp, rem_sdp, i); 317 352 if (status != PJ_SUCCESS) 318 353 return status;
Note: See TracChangeset
for help on using the changeset viewer.