Changeset 385
- Timestamp:
- Apr 5, 2006 5:13:42 PM (19 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
r384 r385 164 164 pj_timestamp ts_freq; /**< System timestamp frequency. */ 165 165 166 pj media_rtcp_ntp_rec rtcp_lsr; /**< NTP ts in last SR received*/167 pj_timestamp r tcp_lsr_time;/**< Time when last SR is received*/166 pj_uint32_t rx_lsr; /**< NTP ts in last SR received */ 167 pj_timestamp rx_lsr_time;/**< Time when last SR is received */ 168 168 pj_uint32_t peer_ssrc; /**< Peer SSRC */ 169 169 unsigned rtt_us; /**< End-to-end delay, in usec. */ -
pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
r384 r385 77 77 78 78 /* Init time */ 79 s->r tcp_lsr.hi = s->rtcp_lsr.lo= 0;80 s->r tcp_lsr_time.u64 = 0;79 s->rx_lsr = 0; 80 s->rx_lsr_time.u64 = 0; 81 81 82 82 /* Init common RTCP header */ … … 183 183 pj_assert(size >= sizeof(pjmedia_rtcp_common)+sizeof(pjmedia_rtcp_sr)); 184 184 185 /* Save NTP timestamp*/186 session->r tcp_lsr.hi = pj_ntohl(rtcp->sr.ntp_sec);187 session->rtcp_lsr.lo = pj_ntohl(rtcp->sr.ntp_frac);185 /* Save LSR from NTP timestamp of RTCP packet */ 186 session->rx_lsr = ((pj_ntohl(rtcp->sr.ntp_sec) & 0x0000FFFF) << 16) | 187 ((pj_ntohl(rtcp->sr.ntp_frac) >> 16) & 0xFFFF); 188 188 189 189 /* Calculate SR arrival time for DLSR */ 190 pj_get_timestamp(&session->r tcp_lsr_time);190 pj_get_timestamp(&session->rx_lsr_time); 191 191 192 192 /* Calculate RTT if it has RR */ … … 295 295 rtcp_pkt->sr.ntp_frac = pj_htonl(ntp.lo); 296 296 297 if (session->r tcp_lsr_time.u64== 0) {297 if (session->rx_lsr_time.u64 == 0 || session->rx_lsr == 0) { 298 298 rtcp_pkt->rr.lsr = 0; 299 299 rtcp_pkt->rr.dlsr = 0; 300 300 } else { 301 301 pj_timestamp ts; 302 pj_uint32_t lsr = session->rx_lsr; 303 pj_uint64_t lsr_time = session->rx_lsr_time.u64; 302 304 303 305 /* Fill in LSR. 304 306 LSR is the middle 32bit of the last SR NTP time received. 305 307 */ 306 rtcp_pkt->rr.lsr = ((session->rtcp_lsr.hi & 0x0000FFFF) << 16) | 307 ((session->rtcp_lsr.lo >> 16) & 0xFFFF); 308 rtcp_pkt->rr.lsr = pj_htonl(rtcp_pkt->rr.lsr); 308 rtcp_pkt->rr.lsr = pj_htonl(lsr); 309 309 310 310 /* Fill in DLSR. … … 313 313 pj_get_timestamp(&ts); 314 314 315 /* Calculate DLSR */316 ts.u64 -= session->rtcp_lsr_time.u64;317 318 315 /* Convert interval to 1/65536 seconds value */ 319 ts.u64 = ((ts.u64 - session->rtcp_lsr_time.u64) << 16) / 320 session->ts_freq.u64; 316 ts.u64 = ((ts.u64 - lsr_time) << 16) / session->ts_freq.u64; 321 317 322 318 rtcp_pkt->rr.dlsr = pj_htonl( (pj_uint32_t)ts.u64 );
Note: See TracChangeset
for help on using the changeset viewer.