Changeset 290
- Timestamp:
- Mar 6, 2006 1:30:39 PM (19 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/stream.h
r215 r290 71 71 pjmedia_sock_info sock_info; /**< Media transport (RTP/RTCP sockets) */ 72 72 pj_sockaddr_in rem_addr; /**< Remote RTP address */ 73 pjmedia_codec_info fmt; /**< Codec format info. */ 73 pjmedia_codec_info fmt; /**< Incoming codec format info. */ 74 unsigned tx_pt; /**< Outgoing codec paylaod type. */ 74 75 int tx_event_pt;/**< Outgoing pt for telephone-events. */ 75 76 int rx_event_pt;/**< Incoming pt for telephone-events. */ -
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 */ -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r229 r290 132 132 133 133 pj_strerror(status, errmsg, sizeof(errmsg)); 134 PJ_LOG( 3,(sender, "%s: %s [err:%d]", title, errmsg, status));134 PJ_LOG(4,(sender, "%s: %s [err:%d]", title, errmsg, status)); 135 135 } 136 136 … … 510 510 status != PJMEDIA_RTP_ESESSRESTART) 511 511 { 512 TRACE_((THIS_FILE, "RTP session_update error", status)); 512 TRACE_((THIS_FILE, "RTP session_update error (details follows)", 513 status)); 514 PJ_LOG(4,(THIS_FILE,"RTP packet detail: pt=%d, seq=%d", 515 hdr->pt, pj_ntohs(hdr->seq))); 513 516 continue; 514 517 } … … 558 561 pjmedia_stream *stream, 559 562 pjmedia_dir dir, 563 unsigned pt, 560 564 const pjmedia_stream_info *param, 561 565 const pjmedia_codec_param *codec_param, … … 575 579 channel->dir = dir; 576 580 channel->paused = 1; 577 channel->pt = p aram->fmt.pt;581 channel->pt = pt; 578 582 579 583 /* Allocate buffer for incoming packet. */ … … 609 613 /* Create RTP and RTCP sessions: */ 610 614 611 status = pjmedia_rtp_session_init(&channel->rtp, param->fmt.pt, 612 param->ssrc); 615 status = pjmedia_rtp_session_init(&channel->rtp, pt, param->ssrc); 613 616 if (status != PJ_SUCCESS) 614 617 return status; … … 749 752 /* Create decoder channel: */ 750 753 751 status = create_channel( pool, stream, PJMEDIA_DIR_DECODING, info,752 &codec_param, &stream->dec);754 status = create_channel( pool, stream, PJMEDIA_DIR_DECODING, 755 info->fmt.pt, info, &codec_param, &stream->dec); 753 756 if (status != PJ_SUCCESS) 754 757 goto err_cleanup; … … 757 760 /* Create encoder channel: */ 758 761 759 status = create_channel( pool, stream, PJMEDIA_DIR_ENCODING, info,760 &codec_param, &stream->enc);762 status = create_channel( pool, stream, PJMEDIA_DIR_ENCODING, 763 info->tx_pt, info, &codec_param, &stream->enc); 761 764 if (status != PJ_SUCCESS) 762 765 goto err_cleanup;
Note: See TracChangeset
for help on using the changeset viewer.