Index: pjproject/trunk/pjmedia/include/pjmedia/config.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 3238)
+++ pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 3239)
@@ -431,4 +431,33 @@
 #endif
 
+
+/**
+ * Specify whether RTCP statistics includes raw jitter statistics.
+ * Raw jitter is defined as absolute value of network transit time
+ * difference of two consecutive packets; refering to "difference D"
+ * term in interarrival jitter calculation in RFC 3550 section 6.4.1.
+ *
+ * Default: 0 (no).
+ */
+#ifndef PJMEDIA_RTCP_STAT_HAS_RAW_JITTER
+#   define PJMEDIA_RTCP_STAT_HAS_RAW_JITTER	0
+#endif
+
+
+/**
+ * Specify whether RTCP statistics includes IP Delay Variation statistics.
+ * IPDV is defined as network transit time difference of two consecutive
+ * packets. The IPDV statistic can be useful to inspect clock skew existance
+ * and level, e.g: when the IPDV mean values were stable in positive numbers,
+ * then the remote clock (used in sending RTP packets) is faster than local
+ * system clock. Ideally, the IPDV mean values are always equal to 0.
+ *
+ * Default: 0 (no).
+ */
+#ifndef PJMEDIA_RTCP_STAT_HAS_IPDV
+#   define PJMEDIA_RTCP_STAT_HAS_IPDV		0
+#endif
+
+
 /**
  * Specify whether RTCP XR support should be built into PJMEDIA. Disabling
Index: pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3238)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3239)
@@ -215,4 +215,16 @@
     pj_uint32_t		     rtp_tx_last_ts; /**< Last TX RTP timestamp.    */
     pj_uint16_t		     rtp_tx_last_seq;/**< Last TX RTP sequence.	    */
+
+#if defined(PJMEDIA_RTCP_STAT_HAS_IPDV) && PJMEDIA_RTCP_STAT_HAS_IPDV!=0
+    pj_math_stat	     rx_ipdv;/**< Statistics of IP packet delay
+				          variation in receiving direction
+					  (in usec).			    */
+#endif
+
+#if defined(PJMEDIA_RTCP_STAT_HAS_RAW_JITTER) && PJMEDIA_RTCP_STAT_HAS_RAW_JITTER!=0
+    pj_math_stat	     rx_raw_jitter;/**< Statistic of raw jitter in
+						receiving direction 
+						(in usec).		    */
+#endif
 };
 
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3238)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3239)
@@ -154,4 +154,12 @@
     pj_math_stat_init(&stat->tx.jitter);
 
+#if defined(PJMEDIA_RTCP_STAT_HAS_IPDV) && PJMEDIA_RTCP_STAT_HAS_IPDV!=0
+    pj_math_stat_init(&stat->rx_ipdv);
+#endif
+
+#if defined(PJMEDIA_RTCP_STAT_HAS_RAW_JITTER) && PJMEDIA_RTCP_STAT_HAS_RAW_JITTER!=0
+    pj_math_stat_init(&stat->rx_raw_jitter);
+#endif
+
     pj_gettimeofday(&now);
     stat->start = now;
@@ -361,7 +369,6 @@
 	    pj_int32_t d;
 	    pj_uint32_t jitter;
-	    
+
 	    d = transit - sess->transit;
-	    sess->transit = transit;
 	    if (d < 0) 
 		d = -d;
@@ -382,4 +389,40 @@
 
 
+#if defined(PJMEDIA_RTCP_STAT_HAS_RAW_JITTER) && PJMEDIA_RTCP_STAT_HAS_RAW_JITTER!=0
+	    {
+		pj_uint32_t raw_jitter;
+
+		/* Convert raw jitter unit from samples to usec */
+		if (d < 4294)
+		    raw_jitter = d * 1000000 / sess->clock_rate;
+		else {
+		    raw_jitter = d * 1000 / sess->clock_rate;
+		    raw_jitter *= 1000;
+		}
+		
+		/* Update jitter stat */
+		pj_math_stat_update(&sess->stat.rx_raw_jitter, raw_jitter);
+	    }
+#endif
+
+
+#if defined(PJMEDIA_RTCP_STAT_HAS_IPDV) && PJMEDIA_RTCP_STAT_HAS_IPDV!=0
+	    {
+		pj_int32_t ipdv;
+
+		ipdv = transit - sess->transit;
+		/* Convert IPDV unit from samples to usec */
+		if (ipdv > -2147 && ipdv < 2147)
+		    ipdv = ipdv * 1000000 / (int)sess->clock_rate;
+		else {
+		    ipdv = ipdv * 1000 / (int)sess->clock_rate;
+		    ipdv *= 1000;
+		}
+		
+		/* Update jitter stat */
+		pj_math_stat_update(&sess->stat.rx_ipdv, ipdv);
+	    }
+#endif
+
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
 	    pjmedia_rtcp_xr_rx_rtp(&sess->xr_session, seq, 
@@ -390,4 +433,7 @@
 				   -1, 0);		    /* toh     */
 #endif
+
+	    /* Update session transit */
+	    sess->transit = transit;
 	}
 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3238)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 3239)
@@ -2248,5 +2248,14 @@
 	       "%s              (msec)    min     avg     max     last    dev\n"
 	       "%s        loss period: %7.3f %7.3f %7.3f %7.3f %7.3f\n"
-	       "%s        jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f%s",
+	       "%s        jitter     : %7.3f %7.3f %7.3f %7.3f %7.3f"
+#if defined(PJMEDIA_RTCP_STAT_HAS_RAW_JITTER) && PJMEDIA_RTCP_STAT_HAS_RAW_JITTER!=0
+	       "\n"
+	       "%s        raw jitter : %7.3f %7.3f %7.3f %7.3f %7.3f"
+#endif
+#if defined(PJMEDIA_RTCP_STAT_HAS_IPDV) && PJMEDIA_RTCP_STAT_HAS_IPDV!=0
+	       "\n"
+	       "%s        IPDV       : %7.3f %7.3f %7.3f %7.3f %7.3f"
+#endif
+	       "%s",
 	       indent, info.stream_info[i].fmt.pt,
 	       last_update,
@@ -2278,4 +2287,20 @@
 	       stat.rx.jitter.last / 1000.0,
 	       pj_math_stat_get_stddev(&stat.rx.jitter) / 1000.0,
+#if defined(PJMEDIA_RTCP_STAT_HAS_RAW_JITTER) && PJMEDIA_RTCP_STAT_HAS_RAW_JITTER!=0
+	       indent,
+	       stat.rx_raw_jitter.min / 1000.0,
+	       stat.rx_raw_jitter.mean / 1000.0,
+	       stat.rx_raw_jitter.max / 1000.0,
+	       stat.rx_raw_jitter.last / 1000.0,
+	       pj_math_stat_get_stddev(&stat.rx_raw_jitter) / 1000.0,
+#endif
+#if defined(PJMEDIA_RTCP_STAT_HAS_IPDV) && PJMEDIA_RTCP_STAT_HAS_IPDV!=0
+	       indent,
+	       stat.rx_ipdv.min / 1000.0,
+	       stat.rx_ipdv.mean / 1000.0,
+	       stat.rx_ipdv.max / 1000.0,
+	       stat.rx_ipdv.last / 1000.0,
+	       pj_math_stat_get_stddev(&stat.rx_ipdv) / 1000.0,
+#endif
 	       ""
 	       );
