Index: pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3236)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3237)
@@ -298,4 +298,12 @@
 
 /**
+ * Initialize bidirectional RTCP statistics.
+ *
+ * @param stat		    The bidirectional RTCP statistics.
+ */
+PJ_DECL(void) pjmedia_rtcp_init_stat(pjmedia_rtcp_stat *stat);
+
+
+/**
  * Initialize RTCP session.
  *
Index: pjproject/trunk/pjmedia/include/pjmedia/session.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/session.h	(revision 3236)
+++ pjproject/trunk/pjmedia/include/pjmedia/session.h	(revision 3237)
@@ -283,4 +283,16 @@
 
 
+/**
+ * Reset session statistics.
+ *
+ * @param session	The media session.
+ * @param index		Stream index.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_session_reset_stream_stat(pjmedia_session *session,
+						       unsigned index);
+
+
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
 /**
Index: pjproject/trunk/pjmedia/include/pjmedia/stream.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/stream.h	(revision 3236)
+++ pjproject/trunk/pjmedia/include/pjmedia/stream.h	(revision 3237)
@@ -227,4 +227,15 @@
 					      pjmedia_rtcp_stat *stat);
 
+
+/**
+ * Reset the stream statistics.
+ *
+ * @param stream	The media stream.
+ *
+ * @return		PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_stream_reset_stat(pjmedia_stream *stream);
+
+
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
 /**
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3236)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3237)
@@ -137,4 +137,27 @@
 
 /*
+ * Initialize bidirectional RTCP statistics.
+ *
+ */
+PJ_DEF(void) pjmedia_rtcp_init_stat(pjmedia_rtcp_stat *stat)
+{
+    pj_time_val now;
+
+    pj_assert(stat);
+
+    pj_bzero(stat, sizeof(pjmedia_rtcp_stat));
+
+    pj_math_stat_init(&stat->rtt);
+    pj_math_stat_init(&stat->rx.loss_period);
+    pj_math_stat_init(&stat->rx.jitter);
+    pj_math_stat_init(&stat->tx.loss_period);
+    pj_math_stat_init(&stat->tx.jitter);
+
+    pj_gettimeofday(&now);
+    stat->start = now;
+}
+
+
+/*
  * Initialize RTCP session.
  */
@@ -195,5 +218,4 @@
     pj_gettimeofday(&now);
     sess->tv_base = now;
-    sess->stat.start = now;
     pj_get_timestamp(&sess->ts_base);
     pj_get_timestamp_freq(&sess->ts_freq);
@@ -201,9 +223,5 @@
 
     /* Initialize statistics states */
-    pj_math_stat_init(&sess->stat.rtt);
-    pj_math_stat_init(&sess->stat.rx.loss_period);
-    pj_math_stat_init(&sess->stat.rx.jitter);
-    pj_math_stat_init(&sess->stat.tx.loss_period);
-    pj_math_stat_init(&sess->stat.tx.jitter);
+    pjmedia_rtcp_init_stat(&sess->stat);
 
     /* RR will be initialized on receipt of the first RTP packet. */
@@ -351,14 +369,16 @@
 	    sess->jitter += d - ((sess->jitter + 8) >> 4);
 
-	    /* Get jitter in usec */
-	    if (d < 4294)
-		jitter = d * 1000000 / sess->clock_rate;
+	    /* Update jitter stat */
+	    jitter = sess->jitter >> 4;
+	    
+	    /* Convert jitter unit from samples to usec */
+	    if (jitter < 4294)
+		jitter = jitter * 1000000 / sess->clock_rate;
 	    else {
-		jitter = d * 1000 / sess->clock_rate;
+		jitter = jitter * 1000 / sess->clock_rate;
 		jitter *= 1000;
 	    }
-
-	    /* Update jitter stat */
 	    pj_math_stat_update(&sess->stat.rx.jitter, jitter);
+
 
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
Index: pjproject/trunk/pjmedia/src/pjmedia/session.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/session.c	(revision 3236)
+++ pjproject/trunk/pjmedia/src/pjmedia/session.c	(revision 3237)
@@ -842,4 +842,16 @@
 
 
+/**
+ * Reset session statistics.
+ */
+PJ_DEF(pj_status_t) pjmedia_session_reset_stream_stat( pjmedia_session *session,
+						       unsigned index)
+{
+    PJ_ASSERT_RETURN(session && index < session->stream_cnt, PJ_EINVAL);
+
+    return pjmedia_stream_reset_stat(session->stream[index]);
+}
+
+
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
 /*
Index: pjproject/trunk/pjmedia/src/pjmedia/stream.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 3236)
+++ pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 3237)
@@ -2485,4 +2485,18 @@
 }
 
+
+/*
+ * Reset the stream statistics in the middle of a stream session.
+ */
+PJ_DEF(pj_status_t) pjmedia_stream_reset_stat(pjmedia_stream *stream)
+{
+    PJ_ASSERT_RETURN(stream, PJ_EINVAL);
+
+    pjmedia_rtcp_init_stat(&stream->rtcp.stat);
+
+    return PJ_SUCCESS;
+}
+
+
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
 /*
