Index: /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/port.h
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/port.h	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/port.h	(revision 2445)
@@ -301,29 +301,24 @@
 PJ_INLINE(void) pjmedia_frame_ext_append_subframe(pjmedia_frame_ext *frm,
 						  const void *src,
-					          pj_uint16_t bitlen,
-						  pj_uint16_t samples_cnt)
-{
+					          unsigned bitlen,
+						  unsigned samples_cnt)
+{
+    pjmedia_frame_ext_subframe *fsub;
     pj_uint8_t *p;
-    unsigned i, tmp;
+    unsigned i;
 
     p = (pj_uint8_t*)frm + sizeof(pjmedia_frame_ext);
     for (i = 0; i < frm->subframe_cnt; ++i) {
-	pjmedia_frame_ext_subframe *fsub;
 	fsub = (pjmedia_frame_ext_subframe*) p;
-	p += sizeof(fsub->bitlen) + (fsub->bitlen >> 3);
-	if (fsub->bitlen & 0x07)
-	    ++p;
+	p += sizeof(fsub->bitlen) + ((fsub->bitlen+7) >> 3);
     }
 
-    tmp = bitlen >> 3;
-    if (bitlen & 0x07)
-	++tmp;
-
-    pj_memcpy(p, &bitlen, sizeof(bitlen));
-    if (tmp)
-	pj_memcpy(p + sizeof(bitlen), src, tmp);
+    fsub = (pjmedia_frame_ext_subframe*) p;
+    fsub->bitlen = (pj_uint16_t)bitlen;
+    if (bitlen)
+	pj_memcpy(fsub->data, src, (bitlen+7) >> 3);
 
     frm->subframe_cnt++;
-    frm->samples_cnt = frm->samples_cnt + samples_cnt;
+    frm->samples_cnt = frm->samples_cnt + (pj_uint16_t)samples_cnt;
 }
 
@@ -349,7 +344,5 @@
 	for (i = 0; i < n; ++i) {	
 	    sf = (pjmedia_frame_ext_subframe*) p;
-	    p += sizeof(sf->bitlen) + (sf->bitlen >> 3);
-	    if (sf->bitlen & 0x07)
-		++p;
+	    p += sizeof(sf->bitlen) + ((sf->bitlen+7) >> 3);
 	}
         
@@ -384,7 +377,5 @@
     sf = pjmedia_frame_ext_get_subframe(frm, frm->subframe_cnt-1);
     move_len = (pj_uint8_t*)sf - move_src + sizeof(sf->bitlen) + 
-	       (sf->bitlen >> 3);
-    if (sf->bitlen & 0x07)
-	++move_len;
+	       ((sf->bitlen+7) >> 3);
     pj_memmove((pj_uint8_t*)frm+sizeof(pjmedia_frame_ext), 
 	       move_src, move_len);
Index: /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/types.h
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/types.h	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/include/pjmedia/types.h	(revision 2445)
@@ -197,6 +197,6 @@
  */
 #define PJMEDIA_FOURCC_L16	PJMEDIA_FOURCC_PACK(' ', 'L', '1', '6')
-#define PJMEDIA_FOURCC_G711A	PJMEDIA_FOURCC_PACK('G', '7', '1', '1')
-#define PJMEDIA_FOURCC_G711U	PJMEDIA_FOURCC_PACK('U', 'L', 'A', 'W')
+#define PJMEDIA_FOURCC_PCMA	PJMEDIA_FOURCC_PACK('A', 'L', 'A', 'W')
+#define PJMEDIA_FOURCC_PCMU	PJMEDIA_FOURCC_PACK('u', 'L', 'A', 'W')
 #define PJMEDIA_FOURCC_AMR	PJMEDIA_FOURCC_PACK(' ', 'A', 'M', 'R')
 #define PJMEDIA_FOURCC_G729	PJMEDIA_FOURCC_PACK('G', '7', '2', '9')
Index: /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-codec/passthrough.c
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-codec/passthrough.c	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia-codec/passthrough.c	(revision 2445)
@@ -163,4 +163,6 @@
     unsigned	     max_bitrate;	/* Maximum bitrate of this codec.   */
     pj_uint8_t	     frm_per_pkt;	/* Default num of frames per packet.*/
+    pj_uint8_t	     vad;		/* VAD enabled/disabled.	    */
+    pj_uint8_t	     plc;		/* PLC enabled/disabled.	    */
     parse_cb	     parse;		/* Callback to parse bitstream.	    */
     pack_cb	     pack;		/* Callback to pack bitstream.	    */
@@ -173,5 +175,5 @@
     {1, "AMR",	    PJMEDIA_RTP_PT_AMR,       {PJMEDIA_FOURCC_AMR},
 		    8000, 1, 160, 
-		    12200, 12200, 2,
+		    7400, 12200, 2, 1, 1,
 		    &parse_amr, &pack_amr
 		    /*, {1, {{{"octet-align", 11}, {"1", 1}}} } */
@@ -182,5 +184,5 @@
     {1, "G729",	    PJMEDIA_RTP_PT_G729,      {PJMEDIA_FOURCC_G729},
 		    8000, 1,  80,
-		    8000, 8000, 2
+		    8000, 8000, 2, 1, 1
     },
 #   endif
@@ -189,5 +191,5 @@
     {1, "iLBC",	    PJMEDIA_RTP_PT_ILBC,      {PJMEDIA_FOURCC_ILBC},
 		    8000, 1,  240,
-		    13333, 15200, 2,
+		    13333, 15200, 1, 1, 1,
 		    NULL, NULL,
 		    {1, {{{"mode", 4}, {"30", 2}}} }
@@ -196,14 +198,14 @@
 
 #   if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMU
-    {1, "PCMU",	    PJMEDIA_RTP_PT_PCMU,      {PJMEDIA_FOURCC_G711U},
+    {1, "PCMU",	    PJMEDIA_RTP_PT_PCMU,      {PJMEDIA_FOURCC_PCMU},
 		    8000, 1,  80,
-		    64000, 64000, 2
+		    64000, 64000, 2, 1, 1
     },
 #   endif
 
 #   if PJMEDIA_HAS_PASSTHROUGH_CODEC_PCMA
-    {1, "PCMA",	    PJMEDIA_RTP_PT_PCMA,      {PJMEDIA_FOURCC_G711A},
+    {1, "PCMA",	    PJMEDIA_RTP_PT_PCMA,      {PJMEDIA_FOURCC_PCMA},
 		    8000, 1,  80,
-		    64000, 64000, 2
+		    64000, 64000, 2, 1, 1
     },
 #   endif
@@ -247,13 +249,15 @@
 	
 	sf = pjmedia_frame_ext_get_subframe(input, i);
-	
-	len = sf->bitlen >> 3;
-	if (sf->bitlen & 0x07)
-	    ++len;
+	len = (sf->bitlen + 7) >> 3;
 	
 	info = (pjmedia_codec_amr_bit_info*) &frames[i].bit_info;
 	pj_bzero(info, sizeof(*info));
-	info->frame_type = pjmedia_codec_amr_get_mode2(enc_setting->amr_nb, 
-						       len);
+	
+	if (len == 0) {
+	    info->frame_type = (pj_uint8_t)(enc_setting->amr_nb? 14 : 15);
+	} else {
+	    info->frame_type = pjmedia_codec_amr_get_mode2(enc_setting->amr_nb, 
+							   len);
+	}
 	info->good_quality = 1;
 	info->mode = setting->enc_mode;
@@ -450,7 +454,7 @@
 	    /* Default flags. */
 	    attr->setting.frm_per_pkt = codec_desc[i].frm_per_pkt;
-	    attr->setting.plc = 0;
+	    attr->setting.plc = codec_desc[i].plc;
 	    attr->setting.penh= 0;
-	    attr->setting.vad = 0;
+	    attr->setting.vad = codec_desc[i].vad;
 	    attr->setting.cng = attr->setting.vad;
 	    attr->setting.dec_fmtp = codec_desc[i].dec_fmtp;
@@ -759,12 +763,20 @@
 		sf = pjmedia_frame_ext_get_subframe(input_, i);
 		pj_assert(sf);
-		
-		sf_len = sf->bitlen >> 3;
-		if (sf->bitlen & 0x07)
-		    ++sf_len;
+
+		sf_len = (sf->bitlen + 7) >> 3;
 
 		pj_memcpy(p, sf->data, sf_len);
 		p += sf_len;
 		output->size += sf_len;
+
+#if PJMEDIA_HAS_INTEL_IPP_CODEC_G729
+		/* If there is SID or DTX frame, break the loop. */
+		if (desc->pt == PJMEDIA_RTP_PT_G729 && 
+		    sf_len < codec_data->avg_frame_size)
+		{
+		    break;
+		}
+#endif
+		
 	    }
 	}
Index: /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/conf_switch.c	(revision 2445)
@@ -52,4 +52,6 @@
 #define INVALID_SLOT	    ((SLOT_TYPE)-1)
 #define BUFFER_SIZE	    PJMEDIA_MAX_MTU
+#define MAX_LEVEL	    (32767)
+#define MIN_LEVEL	    (-32768)
 
 /*
@@ -153,4 +155,8 @@
     conf_port->tx_setting = PJMEDIA_PORT_ENABLE;
 
+    /* Default level adjustment is 128 (which means no adjustment) */
+    conf_port->tx_adj_level = NORMAL_LEVEL;
+    conf_port->rx_adj_level = NORMAL_LEVEL;
+
     /* Create transmit flag array */
     conf_port->listener_slots = (SLOT_TYPE*)
@@ -166,5 +172,4 @@
     f = (pjmedia_frame*)conf_port->tx_buf;
     f->buf = conf_port->tx_buf + sizeof(pjmedia_frame);
-    f->size = 0;
 
     /* Done */
@@ -673,4 +678,6 @@
 
     if (i != src_port->listener_cnt) {
+	pjmedia_frame_ext *f;
+
 	pj_assert(src_port->listener_cnt > 0 && 
 		  src_port->listener_cnt < conf->max_ports);
@@ -683,6 +690,10 @@
 	--dst_port->transmitter_cnt;
 	
-	/* Clean up sink TX buffer. */
-	pj_bzero(dst_port->tx_buf, sizeof(pjmedia_frame_ext));
+	/* Cleanup listener TX buffer. */
+	f = (pjmedia_frame_ext*)dst_port->tx_buf;
+	f->base.type = PJMEDIA_FRAME_TYPE_NONE;
+	f->base.size = 0;
+	f->samples_cnt = 0;
+	f->subframe_cnt = 0;
 
 	PJ_LOG(4,(THIS_FILE,
@@ -777,4 +788,5 @@
 	unsigned dst_slot;
 	struct conf_port *dst_port;
+	pjmedia_frame_ext *f;
 
 	dst_slot = conf_port->listener_slots[conf_port->listener_cnt-1];
@@ -785,6 +797,10 @@
 	--conf->connect_cnt;
 
-	/* Clean up TX buffer. */
-	pj_bzero(dst_port->tx_buf, sizeof(pjmedia_frame_ext));
+	/* Cleanup & reinit listener TX buffer. */
+	f = (pjmedia_frame_ext*)dst_port->tx_buf;
+	f->base.type = PJMEDIA_FRAME_TYPE_NONE;
+	f->base.size = 0;
+	f->samples_cnt = 0;
+	f->subframe_cnt = 0;
     }
 
@@ -857,4 +873,6 @@
     info->bits_per_sample = conf_port->info->bits_per_sample;
     info->format = conf_port->port->info.format;
+    info->tx_adj_level = conf_port->tx_adj_level - NORMAL_LEVEL;
+    info->rx_adj_level = conf_port->rx_adj_level - NORMAL_LEVEL;
 
     return PJ_SUCCESS;
@@ -935,4 +953,9 @@
     conf_port = conf->ports[slot];
 
+    /* Level adjustment is applicable only for ports that work with raw PCM. */
+    PJ_ASSERT_RETURN(conf_port->info->format.u32 == 0 || 
+		     conf_port->info->format.u32 == PJMEDIA_FOURCC_L16,
+		     PJ_EIGNORED);
+
     /* Set normalized adjustment level. */
     conf_port->rx_adj_level = adj_level + NORMAL_LEVEL;
@@ -964,4 +987,12 @@
 
     conf_port = conf->ports[slot];
+
+    /* Level adjustment is applicable only for ports that work with raw PCM. */
+    PJ_ASSERT_RETURN(conf_port->info->format.u32 == 0 || 
+		     conf_port->info->format.u32 == PJMEDIA_FOURCC_L16,
+		     PJ_EIGNORED);
+
+    /* Set normalized adjustment level. */
+    conf_port->tx_adj_level = adj_level + NORMAL_LEVEL;
 
     return PJ_SUCCESS;
@@ -1032,4 +1063,26 @@
 	    if (nsamples_to_copy > nsamples_req)
 		nsamples_to_copy = nsamples_req;
+
+	    /* Adjust TX level. */
+	    if (cport_dst->tx_adj_level != NORMAL_LEVEL) {
+		pj_int16_t *p, *p_end;
+
+		p = f_start;
+		p_end = p + nsamples_to_copy;
+		while (p < p_end) {
+		    pj_int32_t itemp = *p;
+
+		    /* Adjust the level */
+		    itemp = (itemp * cport_dst->tx_adj_level) >> 7;
+
+		    /* Clip the signal if it's too loud */
+		    if (itemp > MAX_LEVEL) itemp = MAX_LEVEL;
+		    else if (itemp < MIN_LEVEL) itemp = MIN_LEVEL;
+
+		    /* Put back in the buffer. */
+		    *p = (pj_int16_t)itemp;
+		    ++p;
+		}
+	    }
 
 	    pjmedia_copy_samples((pj_int16_t*)frm_dst->buf + (frm_dst->size>>1),
@@ -1132,6 +1185,4 @@
     unsigned ci, i;
     
-    PJ_TODO(ADJUST_RX_TX_LEVEL_FOR_PCM_FRAMES);
-
     /* Must lock mutex */
     pj_mutex_lock(conf->mutex);
@@ -1174,5 +1225,5 @@
 	    pj_status_t status;
 	    unsigned j;
-	    pj_int32_t level;
+	    pj_int32_t level = 0;
 
 	    pj_add_timestamp32(&cport->ts_rx, cport->info->samples_per_frame);
@@ -1186,8 +1237,32 @@
 		continue;
 
-	    /* Calculate RX level. */
+	    /* Calculate & adjust RX level. */
 	    if (f->type == PJMEDIA_FRAME_TYPE_AUDIO) {
-		level = pjmedia_calc_avg_signal((const pj_int16_t*)f->buf,
-						f->size >>1 );
+		if (cport->rx_adj_level != NORMAL_LEVEL) {
+		    pj_int16_t *p = (pj_int16_t*)f->buf;
+		    pj_int16_t *end;
+
+		    end = p + (f->size >> 1);
+		    while (p < end) {
+			pj_int32_t itemp = *p;
+
+			/* Adjust the level */
+			itemp = (itemp * cport->rx_adj_level) >> 7;
+
+			/* Clip the signal if it's too loud */
+			if (itemp > MAX_LEVEL) itemp = MAX_LEVEL;
+			else if (itemp < MIN_LEVEL) itemp = MIN_LEVEL;
+
+			level += PJ_ABS(itemp);
+
+			/* Put back in the buffer. */
+			*p = (pj_int16_t)itemp;
+			++p;
+		    }
+		    level /= (f->size >> 1);
+		} else {
+		    level = pjmedia_calc_avg_signal((const pj_int16_t*)f->buf,
+						    f->size >> 1);
+		}
 	    } else if (f->type == PJMEDIA_FRAME_TYPE_EXTENDED) {
 		/* For extended frame, TX level is unknown, so we just set 
@@ -1195,7 +1270,6 @@
 		 */
 		level = NORMAL_LEVEL;
-	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
-		level = 0;
 	    }
+
 	    cport->rx_level = pjmedia_linear2ulaw(level) ^ 0xff;
 
@@ -1221,6 +1295,9 @@
 		}
 
-		/* Set listener TX level equal to transmitter RX level. */
-		listener->tx_level = cport->rx_level;
+		/* Set listener TX level based on transmitter RX level & 
+		 * listener TX level.
+		 */
+		listener->tx_level = (cport->rx_level * listener->tx_adj_level)
+				     >> 8;
 	    }
 	}
@@ -1242,8 +1319,14 @@
 	if (cport->tx_setting==PJMEDIA_PORT_MUTE || cport->transmitter_cnt==0)
 	{
+	    pjmedia_frame_ext *f;
+	    
 	    /* Clear left-over samples in tx_buffer, if any, so that it won't
 	     * be transmitted next time we have audio signal.
 	     */
-	    pj_bzero(cport->tx_buf, sizeof(pjmedia_frame_ext));
+	    f = (pjmedia_frame_ext*)cport->tx_buf;
+	    f->base.type = PJMEDIA_FRAME_TYPE_NONE;
+	    f->base.size = 0;
+	    f->samples_cnt = 0;
+	    f->subframe_cnt = 0;
 	    
 	    cport->tx_level = 0;
@@ -1280,6 +1363,7 @@
 	    
 	    if (f_src_->samples_cnt < this_cport->info->samples_per_frame) {
-		pj_bzero(this_cport->tx_buf, sizeof(pjmedia_frame_ext));
-		frame->type = PJMEDIA_FRAME_TYPE_NONE;
+		f_dst->base.type = PJMEDIA_FRAME_TYPE_NONE;
+		f_dst->samples_cnt = 0;
+		f_dst->subframe_cnt = 0;
 		break;
 	    }
@@ -1303,6 +1387,6 @@
 	} else if (f_src->type == PJMEDIA_FRAME_TYPE_AUDIO) {
 	    if ((f_src->size>>1) < this_cport->info->samples_per_frame) {
-		pj_bzero(this_cport->tx_buf, sizeof(pjmedia_frame_ext));
 		frame->type = PJMEDIA_FRAME_TYPE_NONE;
+		frame->size = 0;
 		break;
 	    }
@@ -1321,7 +1405,10 @@
 				     f_src->size >> 1);
 	} else { /* PJMEDIA_FRAME_TYPE_NONE */
+	    pjmedia_frame_ext *f_dst = (pjmedia_frame_ext*)frame;
+
 	    /* Reset TX buffer */
-	    pj_bzero(this_cport->tx_buf, sizeof(pjmedia_frame_ext));
-	    frame->type = PJMEDIA_FRAME_TYPE_NONE;
+	    f_dst->base.type = PJMEDIA_FRAME_TYPE_NONE;
+	    f_dst->samples_cnt = 0;
+	    f_dst->subframe_cnt = 0;
 	}
     } while (0);
@@ -1342,5 +1429,5 @@
     struct conf_port *cport = conf->ports[this_port->port_data.ldata];
     unsigned j;
-    pj_int32_t level;
+    pj_int32_t level = 0;
 
     pj_add_timestamp32(&cport->ts_rx, cport->info->samples_per_frame);
@@ -1358,8 +1445,32 @@
     }
 
-    /* Calculate RX level. */
+    /* Calculate & adjust RX level. */
     if (f->type == PJMEDIA_FRAME_TYPE_AUDIO) {
-	level = pjmedia_calc_avg_signal((const pj_int16_t*)f->buf,
-					f->size >>1 );
+	if (cport->rx_adj_level != NORMAL_LEVEL) {
+	    pj_int16_t *p = (pj_int16_t*)f->buf;
+	    pj_int16_t *end;
+
+	    end = p + (f->size >> 1);
+	    while (p < end) {
+		pj_int32_t itemp = *p;
+
+		/* Adjust the level */
+		itemp = (itemp * cport->rx_adj_level) >> 7;
+
+		/* Clip the signal if it's too loud */
+		if (itemp > MAX_LEVEL) itemp = MAX_LEVEL;
+		else if (itemp < MIN_LEVEL) itemp = MIN_LEVEL;
+
+		level += PJ_ABS(itemp);
+
+		/* Put back in the buffer. */
+		*p = (pj_int16_t)itemp;
+		++p;
+	    }
+	    level /= (f->size >> 1);
+	} else {
+	    level = pjmedia_calc_avg_signal((const pj_int16_t*)f->buf,
+					    f->size >> 1);
+	}
     } else if (f->type == PJMEDIA_FRAME_TYPE_EXTENDED) {
 	/* For extended frame, TX level is unknown, so we just set 
@@ -1367,7 +1478,6 @@
 	 */
 	level = NORMAL_LEVEL;
-    } else { /* PJMEDIA_FRAME_TYPE_NONE. */
-	level = 0;
-    }
+    }
+
     cport->rx_level = pjmedia_linear2ulaw(level) ^ 0xff;
 
@@ -1402,6 +1512,8 @@
 	}
 
-	/* Set listener TX level equal to transmitter RX level. */
-	listener->tx_level = cport->rx_level;
+	/* Set listener TX level based on transmitter RX level & listener
+	 * TX level.
+	 */
+	listener->tx_level = (cport->rx_level * listener->tx_adj_level) >> 8;
     }
 
Index: /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/stream.c
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/stream.c	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/stream.c	(revision 2445)
@@ -483,5 +483,5 @@
 
 	    if (frame_type == PJMEDIA_JB_MISSING_FRAME) {
-		PJ_LOG(1,(stream->port.info.name.ptr,  "Frame lost!"));
+		PJ_LOG(5,(stream->port.info.name.ptr,  "Frame lost!"));
 	    } else if (frame_type == PJMEDIA_JB_ZERO_EMPTY_FRAME) {
 		/* Jitter buffer is empty. Check if this is the first "empty" 
@@ -493,5 +493,5 @@
 		    /* Report the state of jitter buffer */
 		    pjmedia_jbuf_get_state(stream->jb, &jb_state);
-		    PJ_LOG(1,(stream->port.info.name.ptr, 
+		    PJ_LOG(5,(stream->port.info.name.ptr, 
 			      "Jitter buffer empty (prefetch=%d)", 
 			      jb_state.prefetch));
@@ -507,5 +507,5 @@
 
 		if (stream->jb_last_frm != frame_type) {
-		    PJ_LOG(1,(stream->port.info.name.ptr, 
+		    PJ_LOG(5,(stream->port.info.name.ptr, 
 			      "Jitter buffer is bufferring (prefetch=%d)",
 			      jb_state.prefetch));
Index: /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp
===================================================================
--- /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp	(revision 2444)
+++ /pjproject/branches/projects/aps-direct/pjmedia/src/pjmedia/symbian_sound_aps.cpp	(revision 2445)
@@ -779,6 +779,6 @@
 	break;
 	
-    case PJMEDIA_FOURCC_G711U:
-    case PJMEDIA_FOURCC_G711A:
+    case PJMEDIA_FOURCC_PCMU:
+    case PJMEDIA_FOURCC_PCMA:
 	{
 	    unsigned samples_processed = 0;
@@ -858,10 +858,7 @@
 		     * 0xxxxy00, where xxxx:frame type, y:not sure. 
 		     */
-		    unsigned len = sf->bitlen>>3;
+		    unsigned len = (sf->bitlen+7)>>3;
 		    enum {SID_FT = 8 };
 		    pj_uint8_t amr_header = 4, ft = SID_FT;
-
-		    if (sf->bitlen & 0x07)
-			++len;
 
 		    if (len >= pjmedia_codec_amrnb_framelen[0])
@@ -976,6 +973,6 @@
 	break;
 	
-    case PJMEDIA_FOURCC_G711U:
-    case PJMEDIA_FOURCC_G711A:
+    case PJMEDIA_FOURCC_PCMU:
+    case PJMEDIA_FOURCC_PCMA:
 	{
 	    unsigned samples_ready = 0;
@@ -1105,6 +1102,7 @@
 	strm->setting.format.u32 = PJMEDIA_FOURCC_L16;
 
-    /* Set audio engine settings. */
-    if (strm->setting.format.u32 == PJMEDIA_FOURCC_G711U ||
+    /* Set audio engine fourcc. */
+    if (strm->setting.format.u32 == PJMEDIA_FOURCC_PCMU ||
+	strm->setting.format.u32 == PJMEDIA_FOURCC_PCMA ||
 	strm->setting.format.u32 == PJMEDIA_FOURCC_L16)
     {
@@ -1114,21 +1112,27 @@
     }
 
+    /* Set audio engine mode. */
     if (strm->setting.format.u32 == PJMEDIA_FOURCC_AMR)
     {
 	aps_setting.mode = (TAPSCodecMode)strm->setting.bitrate;
-    } else if (strm->setting.format.u32 == PJMEDIA_FOURCC_G711U ||
-	       strm->setting.format.u32 == PJMEDIA_FOURCC_L16   ||
-	      (strm->setting.format.u32 == PJMEDIA_FOURCC_ILBC  &&
-	       strm->setting.mode == 30))
+    } 
+    else if (strm->setting.format.u32 == PJMEDIA_FOURCC_PCMU ||
+	     strm->setting.format.u32 == PJMEDIA_FOURCC_L16   ||
+	    (strm->setting.format.u32 == PJMEDIA_FOURCC_ILBC  &&
+	     strm->setting.mode == 30))
     {
 	aps_setting.mode = EULawOr30ms;
-    } else {
+    } 
+    else if (strm->setting.format.u32 == PJMEDIA_FOURCC_PCMA ||
+	    (strm->setting.format.u32 == PJMEDIA_FOURCC_ILBC &&
+	     strm->setting.mode == 20))
+    {
 	aps_setting.mode = EALawOr20ms;
     }
 
     /* Disable VAD on L16 and G711. */
-    if (strm->setting.format.u32 == PJMEDIA_FOURCC_L16 ||
-	strm->setting.format.u32 == PJMEDIA_FOURCC_G711U ||
-	strm->setting.format.u32 == PJMEDIA_FOURCC_G711A)
+    if (strm->setting.format.u32 == PJMEDIA_FOURCC_PCMU ||
+	strm->setting.format.u32 == PJMEDIA_FOURCC_PCMA ||
+	strm->setting.format.u32 == PJMEDIA_FOURCC_L16)
     {
 	aps_setting.vad = EFalse;
@@ -1137,8 +1141,10 @@
     }
     
+    /* Set other audio engine attributes. */
     aps_setting.plc = strm->setting.plc;
     aps_setting.cng = strm->setting.cng;
     aps_setting.loudspk = strm->setting.loudspk;
 
+    /* Set audio engine callbacks. */
     if (strm->setting.format.u32 == PJMEDIA_FOURCC_L16) {
 	aps_play_cb = &PlayCbPcm;
@@ -1149,5 +1155,5 @@
     }
 
-    // Create the audio engine.
+    /* Create the audio engine. */
     TRAPD(err, strm->engine = CPjAudioEngine::NewL(strm,
 						   aps_rec_cb, aps_play_cb,
