Index: pjproject/trunk/pjmedia/include/pjmedia/rtcp.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3223)
+++ pjproject/trunk/pjmedia/include/pjmedia/rtcp.h	(revision 3224)
@@ -247,4 +247,5 @@
     pj_timestamp	    ts_base;	/**< Base system timestamp.	    */
     pj_timestamp	    ts_freq;	/**< System timestamp frequency.    */
+    pj_uint32_t		    rtp_ts_base;/**< Base RTP timestamp.	    */
 
     pj_uint32_t		    rx_lsr;	/**< NTP ts in last SR received	    */
@@ -275,4 +276,26 @@
 
 /**
+ * RTCP session settings.
+ */
+typedef struct pjmedia_rtcp_session_setting
+{
+    char	    *name;		/**< RTCP session name.		*/
+    unsigned	     clock_rate;	/**< Sequence.			*/
+    unsigned	     samples_per_frame;	/**< Timestamp.			*/
+    pj_uint32_t	     ssrc;		/**< Sender SSRC.		*/
+    pj_uint32_t	     rtp_ts_base;	/**< Base RTP timestamp.	*/
+} pjmedia_rtcp_session_setting;
+
+
+/**
+ * Initialize RTCP session setting.
+ *
+ * @param settings	    The RTCP session setting to be initialized.
+ */
+PJ_DECL(void) pjmedia_rtcp_session_setting_default(
+				    pjmedia_rtcp_session_setting *settings);
+
+
+/**
  * Initialize RTCP session.
  *
@@ -292,4 +315,14 @@
 
 /**
+ * Initialize RTCP session.
+ *
+ * @param session	    The session
+ * @param settings	    The RTCP session settings.
+ */
+PJ_DECL(void) pjmedia_rtcp_init2(pjmedia_rtcp_session *session,
+				 const pjmedia_rtcp_session_setting *settings);
+
+
+/**
  * Utility function to retrieve current NTP timestamp.
  *
Index: pjproject/trunk/pjmedia/src/pjmedia/rtcp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3223)
+++ pjproject/trunk/pjmedia/src/pjmedia/rtcp.c	(revision 3224)
@@ -126,4 +126,17 @@
 
 
+/*
+ * Initialize RTCP session setting.
+ */
+PJ_DEF(void) pjmedia_rtcp_session_setting_default(
+				    pjmedia_rtcp_session_setting *settings)
+{
+    pj_bzero(&settings, sizeof(*settings));
+}
+
+
+/*
+ * Initialize RTCP session.
+ */
 PJ_DEF(void) pjmedia_rtcp_init(pjmedia_rtcp_session *sess, 
 			       char *name,
@@ -132,4 +145,22 @@
 			       pj_uint32_t ssrc)
 {
+    pjmedia_rtcp_session_setting settings;
+
+    pjmedia_rtcp_session_setting_default(&settings);
+    settings.name = name;
+    settings.clock_rate = clock_rate;
+    settings.samples_per_frame = samples_per_frame;
+    settings.ssrc = ssrc;
+
+    pjmedia_rtcp_init2(sess, &settings);
+}
+
+
+/*
+ * Initialize RTCP session.
+ */
+PJ_DEF(void) pjmedia_rtcp_init2( pjmedia_rtcp_session *sess,
+				 const pjmedia_rtcp_session_setting *settings)
+{
     pjmedia_rtcp_sr_pkt *sr_pkt = &sess->rtcp_sr_pkt;
     pj_time_val now;
@@ -142,9 +173,9 @@
 
     /* Name */
-    sess->name = name ? name : (char*)THIS_FILE,
+    sess->name = settings->name ? settings->name : (char*)THIS_FILE;
 
     /* Set clock rate */
-    sess->clock_rate = clock_rate;
-    sess->pkt_size = samples_per_frame;
+    sess->clock_rate = settings->clock_rate;
+    sess->pkt_size = settings->samples_per_frame;
 
     /* Init common RTCP SR header */
@@ -153,5 +184,5 @@
     sr_pkt->common.pt = RTCP_SR;
     sr_pkt->common.length = pj_htons(12);
-    sr_pkt->common.ssrc = pj_htonl(ssrc);
+    sr_pkt->common.ssrc = pj_htonl(settings->ssrc);
     
     /* Copy to RTCP RR header */
@@ -167,4 +198,5 @@
     pj_get_timestamp(&sess->ts_base);
     pj_get_timestamp_freq(&sess->ts_freq);
+    sess->rtp_ts_base = settings->rtp_ts_base;
 
     /* Initialize statistics states */
@@ -572,4 +604,6 @@
      */
     if (sess->stat.tx.pkt != pj_ntohl(sess->rtcp_sr_pkt.sr.sender_pcount)) {
+	pj_time_val ts_time;
+	pj_uint32_t rtp_ts;
 
 	/* So we should send RTCP SR */
@@ -589,4 +623,12 @@
 	sr->ntp_sec = pj_htonl(ntp.hi);
 	sr->ntp_frac = pj_htonl(ntp.lo);
+
+	/* Fill in RTP timestamp (corresponds to NTP timestamp) in SR. */
+	ts_time.sec = ntp.hi - sess->tv_base.sec - JAN_1970;
+	ts_time.msec = (long)(ntp.lo * 1000.0 / 0xFFFFFFFF);
+	rtp_ts = sess->rtp_ts_base +
+		 (pj_uint32_t)(sess->clock_rate*ts_time.sec) +
+		 (pj_uint32_t)(sess->clock_rate*ts_time.msec/1000);
+	sr->rtp_ts = pj_htonl(rtp_ts);
 
 	TRACE_((sess->name, "TX RTCP SR: ntp_ts=%p", 
Index: pjproject/trunk/pjmedia/src/pjmedia/stream.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 3223)
+++ pjproject/trunk/pjmedia/src/pjmedia/stream.c	(revision 3224)
@@ -2122,26 +2122,9 @@
 				       stream->codec_param.info.channel_cnt;
 
-    /* Init RTCP session: */
-
-    /* Special case for G.722 */
     if (info->fmt.pt == PJMEDIA_RTP_PT_G722) {
-	pjmedia_rtcp_init(&stream->rtcp, stream->port.info.name.ptr,
-			  8000, 
-			  160,
-			  info->ssrc);
 	stream->has_g722_mpeg_bug = PJ_TRUE;
 	/* RTP clock rate = 1/2 real clock rate */
 	stream->rtp_tx_ts_len_per_pkt >>= 1;
-    } else {
-	pjmedia_rtcp_init(&stream->rtcp, stream->port.info.name.ptr,
-			  info->fmt.clock_rate, 
-			  stream->port.info.samples_per_frame, 
-			  info->ssrc);
-    }
-#else
-    pjmedia_rtcp_init(&stream->rtcp, stream->port.info.name.ptr,
-		      info->fmt.clock_rate, 
-		      stream->port.info.samples_per_frame, 
-		      info->ssrc);
+    }
 #endif
 
@@ -2198,4 +2181,27 @@
 	goto err_cleanup;
 
+
+    /* Init RTCP session: */
+
+    {
+	pjmedia_rtcp_session_setting rtcp_setting;
+
+	pjmedia_rtcp_session_setting_default(&rtcp_setting);
+	rtcp_setting.name = stream->port.info.name.ptr;
+	rtcp_setting.ssrc = info->ssrc;
+	rtcp_setting.rtp_ts_base = pj_ntohl(stream->enc->rtp.out_hdr.ts);
+	rtcp_setting.clock_rate = info->fmt.clock_rate;
+	rtcp_setting.samples_per_frame = stream->port.info.samples_per_frame;
+
+#if defined(PJMEDIA_HANDLE_G722_MPEG_BUG) && (PJMEDIA_HANDLE_G722_MPEG_BUG!=0)
+	/* Special case for G.722 */
+	if (info->fmt.pt == PJMEDIA_RTP_PT_G722) {
+	    rtcp_setting.clock_rate = 8000;
+	    rtcp_setting.samples_per_frame = 160;
+	}
+#endif
+
+	pjmedia_rtcp_init2(&stream->rtcp, &rtcp_setting);
+    }
 
     /* Only attach transport when stream is ready. */
