Changeset 2241 for pjproject/trunk
- Timestamp:
- Aug 26, 2008 4:51:28 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
r2039 r2241 211 211 212 212 pj_math_stat rtt; /**< Round trip delay statistic(in usec)*/ 213 214 pj_uint32_t rtp_tx_last_ts; /**< Last TX RTP timestamp. */ 215 pj_uint16_t rtp_tx_last_seq;/**< Last TX RTP sequence. */ 213 216 }; 214 217 -
pjproject/trunk/pjmedia/include/pjmedia/rtp.h
r2039 r2241 221 221 }; 222 222 223 224 /** 225 * RTP session settings. 226 */ 227 typedef struct pjmedia_rtp_session_setting 228 { 229 pj_uint8_t flags; /**< Bitmask flags to specify whether such 230 field is set. Bitmask contents are: 231 (bit #0 is LSB) 232 bit #0: default payload type 233 bit #1: sender SSRC 234 bit #2: sequence 235 bit #3: timestamp */ 236 int default_pt; /**< Default payload type. */ 237 pj_uint32_t sender_ssrc; /**< Sender SSRC. */ 238 pj_uint16_t seq; /**< Sequence. */ 239 pj_uint32_t ts; /**< Timestamp. */ 240 } pjmedia_rtp_session_setting; 241 242 223 243 /** 224 244 * @see pjmedia_rtp_status … … 239 259 int default_pt, 240 260 pj_uint32_t sender_ssrc ); 261 262 /** 263 * This function will initialize the RTP session according to given parameters 264 * defined in RTP session settings. 265 * 266 * @param ses The session. 267 * @param settings RTP session settings. 268 * 269 * @return PJ_SUCCESS if successfull. 270 */ 271 PJ_DECL(pj_status_t) pjmedia_rtp_session_init2( 272 pjmedia_rtp_session *ses, 273 pjmedia_rtp_session_setting settings); 274 241 275 242 276 /** -
pjproject/trunk/pjmedia/include/pjmedia/stream.h
r2236 r2241 113 113 int rx_event_pt;/**< Incoming pt for telephone-events. */ 114 114 pj_uint32_t ssrc; /**< RTP SSRC. */ 115 pj_uint32_t rtp_ts; /**< Initial RTP timestamp. */ 116 pj_uint16_t rtp_seq; /**< Initial RTP sequence number. */ 117 pj_uint8_t rtp_seq_ts_set; 118 /**< Bitmask flags if initial RTP sequence 119 and/or timestamp for sender are set. 120 bit 0/LSB : sequence flag 121 bit 1 : timestamp flag */ 115 122 int jb_init; /**< Jitter buffer init delay in msec. 116 123 (-1 for default). */ -
pjproject/trunk/pjmedia/src/pjmedia/rtp.c
r2039 r2241 85 85 } 86 86 87 PJ_DEF(pj_status_t) pjmedia_rtp_session_init2( 88 pjmedia_rtp_session *ses, 89 pjmedia_rtp_session_setting settings) 90 { 91 pj_status_t status; 92 int pt = 0; 93 pj_uint32_t sender_ssrc = 0; 94 95 if (settings.flags & 1) 96 pt = settings.default_pt; 97 if (settings.flags & 2) 98 sender_ssrc = settings.sender_ssrc; 99 100 status = pjmedia_rtp_session_init(ses, pt, sender_ssrc); 101 if (status != PJ_SUCCESS) 102 return status; 103 104 if (settings.flags & 4) { 105 ses->out_extseq = settings.seq; 106 ses->out_hdr.seq = pj_htons((pj_uint16_t)ses->out_extseq); 107 } 108 if (settings.flags & 8) 109 ses->out_hdr.ts = pj_htonl(settings.ts); 110 111 return PJ_SUCCESS; 112 } 113 87 114 88 115 PJ_DEF(pj_status_t) pjmedia_rtp_encode_rtp( pjmedia_rtp_session *ses, -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r2224 r2241 873 873 /* Update stat */ 874 874 pjmedia_rtcp_tx_rtp(&stream->rtcp, frame_out.size); 875 stream->rtcp.stat.rtp_tx_last_ts = pj_ntohl(stream->enc->rtp.out_hdr.ts); 876 stream->rtcp.stat.rtp_tx_last_seq = pj_ntohs(stream->enc->rtp.out_hdr.seq); 875 877 876 878 return PJ_SUCCESS; … … 1413 1415 /* Create RTP and RTCP sessions: */ 1414 1416 1415 status = pjmedia_rtp_session_init(&channel->rtp, pt, param->ssrc); 1417 if (param->rtp_seq_ts_set == 0) { 1418 status = pjmedia_rtp_session_init(&channel->rtp, pt, param->ssrc); 1419 } else { 1420 pjmedia_rtp_session_setting settings; 1421 1422 settings.flags = (param->rtp_seq_ts_set << 2) | 3; 1423 settings.default_pt = pt; 1424 settings.sender_ssrc = param->ssrc; 1425 settings.seq = param->rtp_seq; 1426 settings.ts = param->rtp_ts; 1427 status = pjmedia_rtp_session_init2(&channel->rtp, settings); 1428 } 1416 1429 if (status != PJ_SUCCESS) 1417 1430 return status; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r2191 r2241 67 67 int audio_idx; /**< Index of m=audio in SDP. */ 68 68 pj_uint32_t ssrc; /**< RTP SSRC */ 69 pj_uint32_t rtp_tx_ts; /**< Initial RTP timestamp for sender. */ 70 pj_uint16_t rtp_tx_seq;/**< Initial RTP sequence for sender. */ 71 pj_uint8_t rtp_tx_seq_ts_set; 72 /**< Bitmask flags if initial RTP sequence 73 and/or timestamp for sender are set. 74 bit 0/LSB : sequence flag 75 bit 1 : timestamp flag */ 69 76 int conf_slot; /**< Slot # in conference bridge. */ 70 77 pjsip_evsub *xfer_sub; /**< Xfer server subscription, if this -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2191 r2241 106 106 call->audio_idx = -1; 107 107 call->ssrc = pj_rand(); 108 call->rtp_tx_seq = 0; 109 call->rtp_tx_ts = 0; 110 call->rtp_tx_seq_ts_set = 0; 108 111 call->xfer_sub = NULL; 109 112 call->last_code = (pjsip_status_code) 0; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r2235 r2241 1159 1159 1160 1160 if (call->session) { 1161 pjmedia_rtcp_stat stat; 1162 1163 if (pjmedia_session_get_stream_stat(call->session, 1164 call->audio_idx, 1165 &stat) == PJ_SUCCESS) 1166 { 1167 /* Save RTP timestamp & sequence, so when media session is 1168 * restarted, those values will be restored as the initial 1169 * RTP timestamp & sequence of the new media session. So in 1170 * the same call session, RTP timestamp and sequence are 1171 * guaranteed to be contigue. 1172 */ 1173 call->rtp_tx_seq_ts_set = 1 | (1 << 1); 1174 call->rtp_tx_seq = stat.rtp_tx_last_seq; 1175 call->rtp_tx_ts = stat.rtp_tx_last_ts; 1176 } 1177 1161 1178 if (pjsua_var.ua_cfg.cb.on_stream_destroyed) { 1162 1179 pjsua_var.ua_cfg.cb.on_stream_destroyed(call_id, call->session, 0); … … 1322 1339 /* Set SSRC */ 1323 1340 si->ssrc = call->ssrc; 1341 1342 /* Set RTP timestamp & sequence, normally these value are intialized 1343 * automatically when stream session created, but for some cases (e.g: 1344 * call reinvite, call update) timestamp and sequence need to be kept 1345 * contigue. 1346 */ 1347 si->rtp_ts = call->rtp_tx_ts; 1348 si->rtp_seq = call->rtp_tx_seq; 1349 si->rtp_seq_ts_set = call->rtp_tx_seq_ts_set; 1324 1350 1325 1351 /* Create session based on session info. */
Note: See TracChangeset
for help on using the changeset viewer.