Index: /pjproject/trunk/pjmedia/include/pjmedia-codec/amr_helper.h
===================================================================
--- /pjproject/trunk/pjmedia/include/pjmedia-codec/amr_helper.h	(revision 2362)
+++ /pjproject/trunk/pjmedia/include/pjmedia-codec/amr_helper.h	(revision 2363)
@@ -613,14 +613,14 @@
  * This structure describes AMR settings.
  */
-typedef struct pjmedia_codec_amr_settings {
-    pj_bool_t  amr_nb;		/**< TRUE for AMR-NB, FALSE for AMR-WB.	*/
-    pj_bool_t  reorder;		/**< Reorder bitstream into descending 
+typedef struct pjmedia_codec_amr_pack_setting {
+    pj_uint8_t amr_nb:1;	/**< Set 1 for AMR-NB, 0 for AMR-WB.	*/
+    pj_uint8_t reorder:1;	/**< Reorder bitstream into descending 
 				     sensitivity order or vice versa.	*/
-    pj_uint8_t octet_aligned;	/**< TRUE if payload is in octet-aligned mode,
+    pj_uint8_t octet_aligned:1;	/**< TRUE if payload is in octet-aligned mode,
 				     FALSE if payload is in bandwidth 
 				     efficient mode.			*/
-    pj_uint8_t CMR;		/**< Change Mode Request for remote
+    pj_uint8_t cmr:4;		/**< Change Mode Request for remote
 				     encoder.				*/
-} pjmedia_codec_amr_settings;
+} pjmedia_codec_amr_pack_setting;
 
 
@@ -686,5 +686,5 @@
  * @param amr_nb    Set PJ_TRUE for AMR-NB and PJ_FALSE for AMR-WB.
  * @param in	    Input frame.
- * @param setting   Settings, see @pjmedia_codec_amr_settings.
+ * @param setting   Settings, see @pjmedia_codec_amr_pack_setting.
  * @param out	    Output frame.
  *
@@ -692,7 +692,7 @@
  */
 PJ_INLINE(pj_status_t) pjmedia_codec_amr_predecode(
-				    const pjmedia_frame *in,
-				    const pjmedia_codec_amr_settings *setting,
-				    pjmedia_frame *out)
+			    const pjmedia_frame *in,
+			    const pjmedia_codec_amr_pack_setting *setting,
+			    pjmedia_frame *out)
 {
     pj_int8_t    amr_bits[477 + 7] = {0};
@@ -758,5 +758,4 @@
 	out_info->mode = in_info->frame_type;
 	out->size = framelen_tbl[out_info->mode];
-	PJ_ASSERT_RETURN(out->size <= in->size, PJMEDIA_CODEC_EFRMINLEN);
 
 	pj_bzero(out->buf, out->size);
@@ -826,5 +825,5 @@
  * @param frames    AMR frames to be packed.
  * @param nframes   Number of frames to be packed.
- * @param setting   Settings, see @pjmedia_codec_amr_settings.
+ * @param setting   Settings, see @pjmedia_codec_amr_pack_setting.
  * @param pkt	    Payload.
  * @param pkt_size  Payload size, as input this specifies payload maximum size,
@@ -834,9 +833,9 @@
  */
 PJ_INLINE (pj_status_t) pjmedia_codec_amr_pack(
-				    const pjmedia_frame frames[],
-				    unsigned nframes,
-				    const pjmedia_codec_amr_settings *setting,
-				    void *pkt, 
-				    pj_size_t *pkt_size)
+			    const pjmedia_frame frames[],
+			    unsigned nframes,
+			    const pjmedia_codec_amr_pack_setting *setting,
+			    void *pkt, 
+			    pj_size_t *pkt_size)
 {
     /* Write cursor */
@@ -876,5 +875,5 @@
 
     /* Code Mode Request, 4 bits */
-    *w = (pj_uint8_t)(setting->CMR << 4);
+    *w = (pj_uint8_t)(setting->cmr << 4);
     w_bitptr = 4;
     if (setting->octet_aligned) {
@@ -1043,19 +1042,19 @@
  * @param pkt_size  Payload size.
  * @param ts	    Base timestamp.
- * @param setting   Settings, see @pjmedia_codec_amr_settings.
+ * @param setting   Settings, see @pjmedia_codec_amr_pack_setting.
  * @param frames    Frames parsed.
  * @param nframes   Number of frames parsed.
- * @param CMR	    Change Mode Request message for local encoder.
+ * @param cmr	    Change Mode Request message for local encoder.
  *
  * @return	    PJ_SUCCESS on success.
  */
 PJ_INLINE(pj_status_t) pjmedia_codec_amr_parse(
-				     void *pkt, 
-				     pj_size_t pkt_size, 
-				     const pj_timestamp *ts,
-				     const pjmedia_codec_amr_settings* setting,
-				     pjmedia_frame frames[], 
-				     unsigned *nframes,
-				     pj_uint8_t *CMR)
+			     void *pkt, 
+			     pj_size_t pkt_size, 
+			     const pj_timestamp *ts,
+			     const pjmedia_codec_amr_pack_setting* setting,
+			     pjmedia_frame frames[], 
+			     unsigned *nframes,
+			     pj_uint8_t *cmr)
 {
     unsigned cnt = 0;
@@ -1090,5 +1089,5 @@
 
     /* Code Mode Request, 4 bits */
-    *CMR = (pj_uint8_t)((*r >> 4) & 0x0F);
+    *cmr = (pj_uint8_t)((*r >> 4) & 0x0F);
     r_bitptr = 4;
     if (setting->octet_aligned) {
Index: /pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c	(revision 2362)
+++ /pjproject/trunk/pjmedia/src/pjmedia-codec/ipp_codecs.c	(revision 2363)
@@ -230,4 +230,5 @@
 		    5900, 12200, 4, 1, 1, 
 		    &predecode_amr, &parse_amr, &pack_amr
+		    /*, {1, {{{"octet-align", 11}, {"1", 1}}} } */
     },
 #   endif
@@ -424,6 +425,6 @@
 
 typedef struct amr_settings_t {
-    pjmedia_codec_amr_settings enc_setting;
-    pjmedia_codec_amr_settings dec_setting;
+    pjmedia_codec_amr_pack_setting enc_setting;
+    pjmedia_codec_amr_pack_setting dec_setting;
     pj_int8_t enc_mode;
 } amr_settings_t;
@@ -442,5 +443,5 @@
     pjmedia_frame frame;
     pjmedia_codec_amr_bit_info *info;
-    pjmedia_codec_amr_settings *setting;
+    pjmedia_codec_amr_pack_setting *setting;
 
     setting = &((amr_settings_t*)codec_data->codec_setting)->dec_setting;
@@ -492,5 +493,5 @@
     pj_uint8_t *r; /* Read cursor */
     pj_uint8_t SID_FT;
-    pjmedia_codec_amr_settings *setting;
+    pjmedia_codec_amr_pack_setting *setting;
 
     setting = &((amr_settings_t*)codec_data->codec_setting)->enc_setting;
@@ -540,18 +541,18 @@
 {
     amr_settings_t* s = (amr_settings_t*)codec_data->codec_setting;
-    pjmedia_codec_amr_settings *setting;
+    pjmedia_codec_amr_pack_setting *setting;
     pj_status_t status;
-    pj_uint8_t CMR;
+    pj_uint8_t cmr;
 
     setting = &s->dec_setting;
 
     status = pjmedia_codec_amr_parse(pkt, pkt_size, ts, setting, frames, 
-				     frame_cnt, &CMR);
+				     frame_cnt, &cmr);
     if (status != PJ_SUCCESS)
 	return status;
 
     /* Check Change Mode Request. */
-    if ((setting->amr_nb && CMR <= 7) || (!setting->amr_nb && CMR <= 8)) {
-	s->enc_mode = CMR;
+    if ((setting->amr_nb && cmr <= 7) || (!setting->amr_nb && cmr <= 8)) {
+	s->enc_mode = cmr;
     }
 
@@ -1024,4 +1025,17 @@
     if (ippc->pt == PJMEDIA_RTP_PT_AMR || ippc->pt == PJMEDIA_RTP_PT_AMRWB) {
 	amr_settings_t *s;
+	pj_uint8_t octet_align = 0;
+	const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11};
+
+	/* Check octet-align */
+	for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) {
+	    if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name, 
+			   &STR_FMTP_OCTET_ALIGN) == 0)
+	    {
+		octet_align=(pj_uint8_t)
+			    (pj_strtoul(&attr->setting.dec_fmtp.param[i].val));
+		break;
+	    }
+	}
 
 	s = PJ_POOL_ZALLOC_T(pool, amr_settings_t);
@@ -1033,10 +1047,10 @@
 
 	s->enc_setting.amr_nb = ippc->pt == PJMEDIA_RTP_PT_AMR;
-	s->enc_setting.octet_aligned = 0;
+	s->enc_setting.octet_aligned = octet_align;
 	s->enc_setting.reorder = PJ_TRUE;
-	s->enc_setting.CMR = 15;
+	s->enc_setting.cmr = 15;
 	
 	s->dec_setting.amr_nb = ippc->pt == PJMEDIA_RTP_PT_AMR;
-	s->dec_setting.octet_aligned = 0;
+	s->dec_setting.octet_aligned = octet_align;
 	s->dec_setting.reorder = PJ_TRUE;
     }
