Index: pjproject/trunk/pjlib/include/pj/os.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/os.h	(revision 886)
+++ pjproject/trunk/pjlib/include/pj/os.h	(revision 887)
@@ -922,4 +922,17 @@
 
 /**
+ * Set timestamp from 32bit values.
+ * @param t	    The timestamp to be set.
+ * @param hi	    The high 32bit part.
+ * @param lo	    The low 32bit part.
+ */
+PJ_INLINE(void) pj_set_timestamp32(pj_timestamp *t, pj_uint32_t hi,
+				   pj_uint32_t lo)
+{
+    t->u32.hi = hi;
+    t->u32.lo = lo;
+}
+
+/**
  * Add timestamp t2 to t1.
  * @param t1	    t1.
@@ -934,4 +947,21 @@
     t1->u32.hi += t2->u32.hi;
     t1->u32.lo += t2->u32.lo;
+    if (t1->u32.lo < old)
+	++t1->u32.hi;
+#endif
+}
+
+/**
+ * Add timestamp t2 to t1.
+ * @param t1	    t1.
+ * @param t2	    t2.
+ */
+PJ_INLINE(void) pj_add_timestamp32(pj_timestamp *t1, pj_uint32_t t2)
+{
+#if PJ_HAS_INT64
+    t1->u64 += t2;
+#else
+    pj_uint32_t old = t1->u32.lo;
+    t1->u32.lo += t2;
     if (t1->u32.lo < old)
 	++t1->u32.hi;
@@ -960,4 +990,41 @@
 
 /**
+ * Substract timestamp t2 from t1.
+ * @param t1	    t1.
+ * @param t2	    t2.
+ */
+PJ_INLINE(void) pj_sub_timestamp32(pj_timestamp *t1, pj_uint32_t t2)
+{
+#if PJ_HAS_INT64
+    t1->u64 -= t2;
+#else
+    if (t1->u32.lo >= t2)
+	t1->u32.lo -= t2;
+    else {
+	t1->u32.lo -= t2;
+	--t1->u32.hi;
+    }
+#endif
+}
+
+/**
+ * Get the timestamp difference between t2 and t1 (that is t2 minus t1),
+ * and return a 32bit signed integer difference.
+ */
+PJ_INLINE(pj_int32_t) pj_timestamp_diff32(const pj_timestamp *t1,
+					  const pj_timestamp *t2)
+{
+    /* Be careful with the signess (I think!) */
+#if PJ_HAS_INT64
+    pj_int64_t diff = t2->u64 - t1->u64;
+    return (pj_int32_t) diff;
+#else
+    pj_int32 diff = t2->u32.lo - t1->u32.lo;
+    return diff;
+#endif
+}
+
+
+/**
  * Calculate the elapsed time, and store it in pj_time_val.
  * This function calculates the elapsed time using highest precision
Index: pjproject/trunk/pjmedia/src/pjmedia/conference.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 886)
+++ pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 887)
@@ -1312,9 +1312,9 @@
  */
 static pj_status_t write_port(pjmedia_conf *conf, struct conf_port *cport,
-			      pj_uint32_t timestamp, 
+			      const pj_timestamp *timestamp, 
 			      pjmedia_frame_type *frm_type)
 {
     pj_int16_t *buf;
-    unsigned j;
+    unsigned j, ts;
     pj_status_t status;
 
@@ -1332,4 +1332,7 @@
 	pjmedia_frame frame;
 
+	/* Adjust the timestamp */
+	frame.timestamp.u64 = timestamp->u64 * cport->clock_rate /
+				conf->clock_rate;
 	frame.type = PJMEDIA_FRAME_TYPE_NONE;
 	frame.buf = NULL;
@@ -1458,5 +1461,8 @@
 	    frame.buf = (pj_int16_t*)cport->mix_buf;
 	    frame.size = conf->samples_per_frame * BYTES_PER_SAMPLE;
-	    frame.timestamp.u64 = timestamp;
+	    /* No need to adjust timestamp, port has the same
+	     * clock rate as conference bridge 
+	     */
+	    frame.timestamp = *timestamp;
 
 	    TRACE_((THIS_FILE, "put_frame %.*s, count=%d", 
@@ -1492,4 +1498,5 @@
     /* Transmit while we have enough frame in the tx_buf. */
     status = PJ_SUCCESS;
+    ts = 0;
     while (cport->tx_buf_count >= cport->samples_per_frame &&
 	   status == PJ_SUCCESS) 
@@ -1506,5 +1513,13 @@
 	    frame.buf = cport->tx_buf;
 	    frame.size = cport->samples_per_frame * BYTES_PER_SAMPLE;
-	    frame.timestamp.u64 = timestamp;
+	    /* Adjust timestamp as port may have different clock rate
+	     * than the bridge.
+	     */
+	    frame.timestamp.u64 = timestamp->u64 * cport->clock_rate /
+				  conf->clock_rate;
+
+	    /* Add timestamp for individual frame */
+	    frame.timestamp.u64 += ts;
+	    ts += cport->samples_per_frame;
 
 	    TRACE_((THIS_FILE, "put_frame %.*s, count=%d", 
@@ -1747,5 +1762,5 @@
 	++ci;
 
-	status = write_port( conf, conf_port, frame->timestamp.u32.lo,
+	status = write_port( conf, conf_port, &frame->timestamp,
 			     &frm_type);
 	if (status != PJ_SUCCESS) {
