Index: pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp	(revision 3115)
+++ pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp	(revision 3116)
@@ -1035,5 +1035,8 @@
 		    buf.iBuffer.Append((TUint8*)sf->data, len);
 		} else {
-		    buf.iBuffer.Append(0);
+		    enum {NO_DATA_FT = 15 };
+		    pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+		    buf.iBuffer.Append(amr_header);
 		}
 
@@ -1041,6 +1044,9 @@
 	    
 	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
-		buf.iBuffer.Append(0);
-		
+		enum {NO_DATA_FT = 15 };
+		pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+		buf.iBuffer.Append(amr_header);
+
 		frame->samples_cnt = 0;
 		frame->subframe_cnt = 0;
Index: pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp	(revision 3115)
+++ pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_vas_dev.cpp	(revision 3116)
@@ -416,5 +416,5 @@
 TInt CPjAudioEngine::StartPlay()
 {
-    TInt err;
+    TInt err = KErrNone;
     
     pj_assert(iVoIPDnlink);
@@ -429,5 +429,4 @@
 	    err = g711dec_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
 				      setting_.mode);
-	    pj_assert(err == KErrNone);
 	}
 	break;
@@ -439,11 +438,18 @@
 	    err = ilbcdec_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
 				      setting_.mode);
-	    pj_assert(err == KErrNone);
-	}
-	break;
-
+	}
+	break;
+
+    case EAMR_NB:
+	/* Ticket #1008: AMR playback issue on few devices, e.g: E72, E52 */
+	err = dec_fmt_if->SetFrameMode(ETrue);
+	break;
+	
     default:
 	break;
     }
+
+    if (err != KErrNone)
+	goto on_return;
     
     /* Configure audio routing */
@@ -452,5 +458,6 @@
     /* Start player */
     err = iVoIPDnlink->Start();
-    
+
+on_return:
     if (err == KErrNone) {
 	dn_state_ = STATE_STREAMING;
@@ -465,5 +472,5 @@
 TInt CPjAudioEngine::StartRec()
 {
-    TInt err;
+    TInt err = KErrNone;
     
     pj_assert(iVoIPUplink);
@@ -478,5 +485,4 @@
 	    err = g711enc_if->SetMode((CVoIPFormatIntfc::TG711CodecMode)
 				      setting_.mode);
-	    pj_assert(err == KErrNone);
 	}
 	break;
@@ -488,10 +494,9 @@
 	    err = ilbcenc_if->SetMode((CVoIPFormatIntfc::TILBCCodecMode)
 				      setting_.mode);
-	    pj_assert(err == KErrNone);
 	}
 	break;
 	
     case EAMR_NB:
-	enc_fmt_if->SetBitRate(setting_.mode);
+	err = enc_fmt_if->SetBitRate(setting_.mode);
 	break;
 	
@@ -499,4 +504,7 @@
 	break;
     }
+    
+    if (err != KErrNone)
+	goto on_return;
     
     /* Configure general codec setting */
@@ -505,5 +513,6 @@
     /* Start recorder */
     err = iVoIPUplink->Start();
-    
+
+on_return:
     if (err == KErrNone) {
 	up_state_ = STATE_STREAMING;
@@ -1113,5 +1122,8 @@
 		    buffer.Append((TUint8*)sf->data, len);
 		} else {
-		    buffer.Append(0);
+		    enum {NO_DATA_FT = 15 };
+		    pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+		    buffer.Append(amr_header);
 		}
 
@@ -1119,5 +1131,8 @@
 	    
 	    } else { /* PJMEDIA_FRAME_TYPE_NONE */
-		buffer.Append(0);
+		enum {NO_DATA_FT = 15 };
+		pj_uint8_t amr_header = 4 || (NO_DATA_FT << 3);
+
+		buffer.Append(amr_header);
 		
 		frame->samples_cnt = 0;
Index: pjproject/trunk/pjmedia/src/pjmedia/codec.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/codec.c	(revision 3115)
+++ pjproject/trunk/pjmedia/src/pjmedia/codec.c	(revision 3116)
@@ -86,8 +86,10 @@
 
     /* Destroy mutex */
-    pj_mutex_destroy(mgr->mutex);
+    if (mgr->mutex)
+	pj_mutex_destroy(mgr->mutex);
 
     /* Release pool */
-    pj_pool_release(mgr->pool);
+    if (mgr->pool)
+	pj_pool_release(mgr->pool);
 
     /* Just for safety, set codec manager states to zero */
Index: pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp
===================================================================
--- pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp	(revision 3115)
+++ pjproject/trunk/pjsip-apps/src/symsndtest/app_main.cpp	(revision 3116)
@@ -41,7 +41,25 @@
 static unsigned rec_cnt, play_cnt;
 static pj_time_val t_start;
-
-pj_pool_t *pool;
-pjmedia_delay_buf *delaybuf;
+static pjmedia_aud_param param;
+static pj_pool_t *pool;
+static pjmedia_delay_buf *delaybuf;
+static char frame_buf[256];
+
+static void copy_frame_ext(pjmedia_frame_ext *f_dst, 
+                           const pjmedia_frame_ext *f_src) 
+{
+    pj_bzero(f_dst, sizeof(*f_dst));
+    if (f_src->subframe_cnt) {
+	f_dst->base.type = PJMEDIA_FRAME_TYPE_EXTENDED;
+	for (unsigned i = 0; i < f_src->subframe_cnt; ++i) {
+	    pjmedia_frame_ext_subframe *sf;
+	    sf = pjmedia_frame_ext_get_subframe(f_src, i);
+	    pjmedia_frame_ext_append_subframe(f_dst, sf->data, sf->bitlen, 
+					      param.samples_per_frame);
+	}
+    } else {
+	f_dst->base.type = PJMEDIA_FRAME_TYPE_NONE;
+    }
+}
 
 /* Logging callback */
@@ -138,9 +156,16 @@
     PJ_UNUSED_ARG(user_data);
 
-    pjmedia_delay_buf_put(delaybuf, (pj_int16_t*)frame->buf);
-
-    if (frame->size != SAMPLES_PER_FRAME*2) {
-		PJ_LOG(3, (THIS_FILE, "Size captured = %u",
-	 		   frame->size));
+    if (param.ext_fmt.id == PJMEDIA_FORMAT_PCM) {
+	pjmedia_delay_buf_put(delaybuf, (pj_int16_t*)frame->buf);
+    
+	if (frame->size != SAMPLES_PER_FRAME*2) {
+		    PJ_LOG(3, (THIS_FILE, "Size captured = %u",
+			       frame->size));
+	}
+    } else {
+	pjmedia_frame_ext *f_src = (pjmedia_frame_ext*)frame;
+	pjmedia_frame_ext *f_dst = (pjmedia_frame_ext*)frame_buf;
+	
+	copy_frame_ext(f_dst, f_src);
     }
 
@@ -155,7 +180,14 @@
     PJ_UNUSED_ARG(user_data);
 
-    pjmedia_delay_buf_get(delaybuf, (pj_int16_t*)frame->buf);
-    frame->size = SAMPLES_PER_FRAME*2;
-    frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
+    if (param.ext_fmt.id == PJMEDIA_FORMAT_PCM) {
+	pjmedia_delay_buf_get(delaybuf, (pj_int16_t*)frame->buf);
+	frame->size = SAMPLES_PER_FRAME*2;
+	frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
+    } else {
+	pjmedia_frame_ext *f_src = (pjmedia_frame_ext*)frame_buf;
+	pjmedia_frame_ext *f_dst = (pjmedia_frame_ext*)frame;
+
+	copy_frame_ext(f_dst, f_src);
+    }
 
     ++play_cnt;
@@ -166,5 +198,4 @@
 static pj_status_t snd_start(unsigned flag)
 {
-    pjmedia_aud_param param;
     pj_status_t status;
 
@@ -179,4 +210,7 @@
     param.samples_per_frame = SAMPLES_PER_FRAME;
     param.dir = (pjmedia_dir) flag;
+    param.ext_fmt.id = PJMEDIA_FORMAT_AMR;
+    param.ext_fmt.bitrate = 12200;
+    param.output_route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
 
     status = pjmedia_aud_stream_create(&param, &rec_cb, &play_cb, NULL, &strm);
