Index: pjproject/trunk/pjmedia/include/pjmedia/config.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 4196)
+++ pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 4197)
@@ -372,8 +372,16 @@
 
 /**
- * Max packet size to support.
+ * Max packet size for transmitting direction.
  */
 #ifndef PJMEDIA_MAX_MTU			
 #  define PJMEDIA_MAX_MTU			1500
+#endif
+
+
+/**
+ * Max packet size for receiving direction.
+ */
+#ifndef PJMEDIA_MAX_MRU			
+#  define PJMEDIA_MAX_MRU			2000
 #endif
 
Index: pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c	(revision 4196)
+++ pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c	(revision 4197)
@@ -35,7 +35,9 @@
 #define THIS_FILE   "transport_srtp.c"
 
-/* Maximum size of packet */
-#define MAX_RTP_BUFFER_LEN	    1500
-#define MAX_RTCP_BUFFER_LEN	    1500
+/* Maximum size of outgoing packet */
+#define MAX_RTP_BUFFER_LEN	    PJMEDIA_MAX_MTU
+#define MAX_RTCP_BUFFER_LEN	    PJMEDIA_MAX_MTU
+
+/* Maximum SRTP crypto key length */
 #define MAX_KEY_LEN		    32
 
@@ -778,5 +780,5 @@
 	return pjmedia_transport_send_rtp(srtp->member_tp, pkt, size);
 
-    if (size > sizeof(srtp->rtp_tx_buffer))
+    if (size > sizeof(srtp->rtp_tx_buffer) - 10)
 	return PJ_ETOOBIG;
 
@@ -792,5 +794,6 @@
 
     if (err == err_status_ok) {
-	status = pjmedia_transport_send_rtp(srtp->member_tp, srtp->rtp_tx_buffer, len);
+	status = pjmedia_transport_send_rtp(srtp->member_tp, 
+					    srtp->rtp_tx_buffer, len);
     } else {
 	status = PJMEDIA_ERRNO_FROM_LIBSRTP(err);
@@ -823,5 +826,5 @@
     }
 
-    if (size > sizeof(srtp->rtcp_tx_buffer))
+    if (size > sizeof(srtp->rtcp_tx_buffer) - 10)
 	return PJ_ETOOBIG;
 
Index: pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c	(revision 4196)
+++ pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c	(revision 4197)
@@ -30,5 +30,5 @@
 
 /* Maximum size of incoming RTP packet */
-#define RTP_LEN	    PJMEDIA_MAX_MTU
+#define RTP_LEN	    PJMEDIA_MAX_MRU
 
 /* Maximum size of incoming RTCP packet */
@@ -43,5 +43,5 @@
 typedef struct pending_write
 {
-    char		buffer[RTP_LEN];
+    char		buffer[PJMEDIA_MAX_MTU];
     pj_ioqueue_op_key_t	op_key;
 } pending_write;
@@ -753,5 +753,5 @@
 
     /* Check that the size is supported */
-    PJ_ASSERT_RETURN(size <= RTP_LEN, PJ_ETOOBIG);
+    PJ_ASSERT_RETURN(size <= PJMEDIA_MAX_MTU, PJ_ETOOBIG);
 
     /* Simulate packet lost on TX direction */
Index: pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 4196)
+++ pjproject/trunk/pjmedia/src/pjmedia/vid_stream.c	(revision 4197)
@@ -69,4 +69,11 @@
 #endif
 
+/* Due to network MTU limitation, a picture bitstream may be splitted into
+ * several chunks for RTP delivery. The chunk number may vary depend on the
+ * picture resolution and MTU. This constant specifies the minimum chunk
+ * number to be allocated to store a picture bitstream in decoding direction.
+ */
+#define MIN_CHUNKS_PER_FRM	30
+
 /* Video stream keep-alive feature is currently disabled. */
 #if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA != 0
@@ -1358,5 +1365,4 @@
     pjmedia_video_format_detail *vfd_enc, *vfd_dec;
     char *p;
-    unsigned dec_mtu;
     pj_status_t status;
 
@@ -1411,7 +1417,5 @@
 	info->codec_param->enc_mtu = PJMEDIA_MAX_MTU;
 
-    /* MTU estimation for decoding direction */
-    dec_mtu = PJMEDIA_MAX_MTU;
-
+    /* Packet size estimation for decoding direction */
     vfd_enc = pjmedia_format_get_video_format_detail(
 					&info->codec_param->enc_fmt, PJ_TRUE);
@@ -1529,6 +1533,7 @@
     /* Init jitter buffer parameters: */
     frm_ptime	    = 1000 * vfd_enc->fps.denum / vfd_enc->fps.num;
-    chunks_per_frm  = stream->frame_size / dec_mtu;
-    if (chunks_per_frm == 0) chunks_per_frm = 1;
+    chunks_per_frm  = stream->frame_size / PJMEDIA_MAX_MRU;
+    if (chunks_per_frm < MIN_CHUNKS_PER_FRM)
+	chunks_per_frm = MIN_CHUNKS_PER_FRM;
 
     /* JB max count, default 500ms */
@@ -1565,5 +1570,5 @@
     /* Create jitter buffer */
     status = pjmedia_jbuf_create(pool, &stream->dec->port.info.name,
-                                 dec_mtu + PJMEDIA_STREAM_RESV_PAYLOAD_LEN,
+                                 PJMEDIA_MAX_MRU,
 				 1000 * vfd_enc->fps.denum / vfd_enc->fps.num,
 				 jb_max, &stream->jb);
Index: pjproject/trunk/pjnath/include/pjnath/stun_sock.h
===================================================================
--- pjproject/trunk/pjnath/include/pjnath/stun_sock.h	(revision 4196)
+++ pjproject/trunk/pjnath/include/pjnath/stun_sock.h	(revision 4197)
@@ -219,5 +219,7 @@
 {
     /**
-     * Packet buffer size. Default value is PJ_STUN_SOCK_PKT_LEN.
+     * Packet buffer size.
+     *
+     * Default value is PJ_STUN_SOCK_PKT_LEN.
      */
     unsigned max_pkt_size;
Index: pjproject/trunk/pjnath/include/pjnath/turn_sock.h
===================================================================
--- pjproject/trunk/pjnath/include/pjnath/turn_sock.h	(revision 4196)
+++ pjproject/trunk/pjnath/include/pjnath/turn_sock.h	(revision 4197)
@@ -109,4 +109,11 @@
 typedef struct pj_turn_sock_cfg
 {
+    /**
+     * Packet buffer size.
+     *
+     * Default value is PJ_TURN_MAX_PKT_LEN.
+     */
+    unsigned max_pkt_size;
+
     /**
      * QoS traffic type to be set on this transport. When application wants
Index: pjproject/trunk/pjnath/src/pjnath/turn_sock.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/turn_sock.c	(revision 4196)
+++ pjproject/trunk/pjnath/src/pjnath/turn_sock.c	(revision 4197)
@@ -98,4 +98,5 @@
 {
     pj_bzero(cfg, sizeof(*cfg));
+    cfg->max_pkt_size = PJ_TURN_MAX_PKT_LEN;
     cfg->qos_type = PJ_QOS_TYPE_BEST_EFFORT;
     cfg->qos_ignore_error = PJ_TRUE;
@@ -475,5 +476,5 @@
     /* Kick start pending read operation */
     status = pj_activesock_start_read(asock, turn_sock->pool, 
-				      PJ_TURN_MAX_PKT_LEN, 0);
+				      turn_sock->setting.max_pkt_size, 0);
 
     /* Init send_key */
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 4196)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 4197)
@@ -720,4 +720,8 @@
 		  sizeof(cfg->qos_params));
     }
+
+    /* Configure packet size for STUN and TURN sockets */
+    ice_cfg.stun.cfg.max_pkt_size = PJMEDIA_MAX_MRU;
+    ice_cfg.turn.cfg.max_pkt_size = PJMEDIA_MAX_MRU;
 
     pj_bzero(&ice_cb, sizeof(pjmedia_ice_cb));
