Added PJMEDIA_RTCP_IGNORE_FIRST_PACKETS macro to let application decides how many first RTP packets to ignore when calculating jitter

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@618 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h
index f97fb79..9e4621d 100644
--- a/pjmedia/include/pjmedia/config.h
+++ b/pjmedia/include/pjmedia/config.h
@@ -146,6 +146,20 @@
 
 
 /**
+ * Tell RTCP to ignore the first N packets when calculating the
+ * jitter statistics. From experimentation, the first few packets
+ * (25 or so) have relatively big jitter, possibly because during
+ * this time, the program is also busy setting up the signaling,
+ * so they make the average jitter big.
+ *
+ * Default: 25.
+ */
+#ifndef PJMEDIA_RTCP_IGNORE_FIRST_PACKETS
+#   define  PJMEDIA_RTCP_IGNORE_FIRST_PACKETS	25
+#endif
+
+
+/**
  * G.711 Appendix I Packet Lost Concealment (PLC).
  * Enabled only when floating point is enabled.
  */
diff --git a/pjmedia/src/pjmedia/rtcp.c b/pjmedia/src/pjmedia/rtcp.c
index 63f8473..f43cc2c 100644
--- a/pjmedia/src/pjmedia/rtcp.c
+++ b/pjmedia/src/pjmedia/rtcp.c
@@ -274,7 +274,9 @@
 	/* Ignore the first N packets as they normally have bad jitter
 	 * due to other threads working to establish the call
 	 */
-	if (sess->transit == 0 || sess->received < 25 ) {
+	if (sess->transit == 0 || 
+	    sess->received < PJMEDIA_RTCP_IGNORE_FIRST_PACKETS) 
+	{
 	    sess->transit = transit;
 	    sess->stat.rx.jitter.min = 2000;
 	} else {