Changeset 3237 for pjproject/trunk
- Timestamp:
- Jul 15, 2010 10:18:59 AM (14 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
r3224 r3237 298 298 299 299 /** 300 * Initialize bidirectional RTCP statistics. 301 * 302 * @param stat The bidirectional RTCP statistics. 303 */ 304 PJ_DECL(void) pjmedia_rtcp_init_stat(pjmedia_rtcp_stat *stat); 305 306 307 /** 300 308 * Initialize RTCP session. 301 309 * -
pjproject/trunk/pjmedia/include/pjmedia/session.h
r2844 r3237 283 283 284 284 285 /** 286 * Reset session statistics. 287 * 288 * @param session The media session. 289 * @param index Stream index. 290 * 291 * @return PJ_SUCCESS on success. 292 */ 293 PJ_DECL(pj_status_t) pjmedia_session_reset_stream_stat(pjmedia_session *session, 294 unsigned index); 295 296 285 297 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 286 298 /** -
pjproject/trunk/pjmedia/include/pjmedia/stream.h
r2844 r3237 227 227 pjmedia_rtcp_stat *stat); 228 228 229 230 /** 231 * Reset the stream statistics. 232 * 233 * @param stream The media stream. 234 * 235 * @return PJ_SUCCESS on success. 236 */ 237 PJ_DECL(pj_status_t) pjmedia_stream_reset_stat(pjmedia_stream *stream); 238 239 229 240 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 230 241 /** -
pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
r3226 r3237 137 137 138 138 /* 139 * Initialize bidirectional RTCP statistics. 140 * 141 */ 142 PJ_DEF(void) pjmedia_rtcp_init_stat(pjmedia_rtcp_stat *stat) 143 { 144 pj_time_val now; 145 146 pj_assert(stat); 147 148 pj_bzero(stat, sizeof(pjmedia_rtcp_stat)); 149 150 pj_math_stat_init(&stat->rtt); 151 pj_math_stat_init(&stat->rx.loss_period); 152 pj_math_stat_init(&stat->rx.jitter); 153 pj_math_stat_init(&stat->tx.loss_period); 154 pj_math_stat_init(&stat->tx.jitter); 155 156 pj_gettimeofday(&now); 157 stat->start = now; 158 } 159 160 161 /* 139 162 * Initialize RTCP session. 140 163 */ … … 195 218 pj_gettimeofday(&now); 196 219 sess->tv_base = now; 197 sess->stat.start = now;198 220 pj_get_timestamp(&sess->ts_base); 199 221 pj_get_timestamp_freq(&sess->ts_freq); … … 201 223 202 224 /* Initialize statistics states */ 203 pj_math_stat_init(&sess->stat.rtt); 204 pj_math_stat_init(&sess->stat.rx.loss_period); 205 pj_math_stat_init(&sess->stat.rx.jitter); 206 pj_math_stat_init(&sess->stat.tx.loss_period); 207 pj_math_stat_init(&sess->stat.tx.jitter); 225 pjmedia_rtcp_init_stat(&sess->stat); 208 226 209 227 /* RR will be initialized on receipt of the first RTP packet. */ … … 351 369 sess->jitter += d - ((sess->jitter + 8) >> 4); 352 370 353 /* Get jitter in usec */ 354 if (d < 4294) 355 jitter = d * 1000000 / sess->clock_rate; 371 /* Update jitter stat */ 372 jitter = sess->jitter >> 4; 373 374 /* Convert jitter unit from samples to usec */ 375 if (jitter < 4294) 376 jitter = jitter * 1000000 / sess->clock_rate; 356 377 else { 357 jitter = d* 1000 / sess->clock_rate;378 jitter = jitter * 1000 / sess->clock_rate; 358 379 jitter *= 1000; 359 380 } 360 361 /* Update jitter stat */362 381 pj_math_stat_update(&sess->stat.rx.jitter, jitter); 382 363 383 364 384 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) -
pjproject/trunk/pjmedia/src/pjmedia/session.c
r2844 r3237 842 842 843 843 844 /** 845 * Reset session statistics. 846 */ 847 PJ_DEF(pj_status_t) pjmedia_session_reset_stream_stat( pjmedia_session *session, 848 unsigned index) 849 { 850 PJ_ASSERT_RETURN(session && index < session->stream_cnt, PJ_EINVAL); 851 852 return pjmedia_stream_reset_stat(session->stream[index]); 853 } 854 855 844 856 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 845 857 /* -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r3224 r3237 2485 2485 } 2486 2486 2487 2488 /* 2489 * Reset the stream statistics in the middle of a stream session. 2490 */ 2491 PJ_DEF(pj_status_t) pjmedia_stream_reset_stat(pjmedia_stream *stream) 2492 { 2493 PJ_ASSERT_RETURN(stream, PJ_EINVAL); 2494 2495 pjmedia_rtcp_init_stat(&stream->rtcp.stat); 2496 2497 return PJ_SUCCESS; 2498 } 2499 2500 2487 2501 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 2488 2502 /*
Note: See TracChangeset
for help on using the changeset viewer.