Changeset 381 for pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
- Timestamp:
- Apr 4, 2006 7:43:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
r378 r381 28 28 29 29 30 #define USE_TIMESTAMP PJ_HAS_HIGH_RES_TIMER 31 30 32 31 33 /* … … 46 48 47 49 PJ_DEF(void) pjmedia_rtcp_init(pjmedia_rtcp_session *s, 50 unsigned clock_rate, 48 51 pj_uint32_t ssrc) 49 52 { … … 52 55 pj_memset(rtcp_pkt, 0, sizeof(pjmedia_rtcp_pkt)); 53 56 57 /* Set clock rate */ 58 s->clock_rate = clock_rate; 59 54 60 /* Init time */ 55 61 s->rtcp_lsr.hi = s->rtcp_lsr.lo = 0; … … 65 71 rtcp_pkt->sr.ssrc = pj_htonl(ssrc); 66 72 73 /* Get timestamp frequency */ 74 #if USE_TIMESTAMP 75 pj_get_timestamp_freq(&s->ts_freq); 76 #endif 77 67 78 /* RR will be initialized on receipt of the first RTP packet. */ 68 79 } … … 91 102 pj_uint32_t arrival; 92 103 pj_int32_t transit; 93 unsigned long timer_tick;94 pj_time_val tv;95 104 int status; 96 105 … … 107 116 ++s->received; 108 117 109 pj_gettimeofday(&tv);110 timer_tick = tv.sec * 1000 + tv.msec;111 112 118 /* 113 119 * Calculate jitter (s->jitter is in timer tick unit) 114 120 */ 115 PJ_TODO(SUPPORT_JITTER_CALCULATION_FOR_NON_8KHZ_SAMPLE_RATE) 116 117 arrival = timer_tick << 3; // 8 samples per ms. 121 #if USE_TIMESTAMP 122 { 123 pj_timestamp ts; 124 125 pj_get_timestamp(&ts); 126 127 /* Convert timestamp to samples */ 128 ts.u64 = ts.u64 * s->clock_rate / s->ts_freq.u64; 129 arrival = (pj_uint32_t)ts.u64; 130 } 131 #else 132 { 133 pj_time_val tv; 134 unsigned long timer_tick; 135 136 pj_gettimeofday(&tv); 137 timer_tick = tv.sec * 1000 + tv.msec; 138 139 /* Convert timer tick to samples */ 140 arrival = timer_tick * s->clock_rate / 1000; 141 } 142 #endif 143 118 144 transit = arrival - rtp_ts; 119 145
Note: See TracChangeset
for help on using the changeset viewer.