Index: pjproject/trunk/pjmedia/include/pjmedia/conference.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/conference.h	(revision 346)
+++ pjproject/trunk/pjmedia/include/pjmedia/conference.h	(revision 347)
@@ -62,4 +62,7 @@
 				     microphone device.			    */
     PJMEDIA_CONF_NO_DEVICE = 2,	/**< Do not create sound device.	    */
+    PJMEDIA_CONF_SMALL_FILTER=4,/**< Use small filter table when resampling */
+    PJMEDIA_CONF_USE_LINEAR=8,	/**< Use linear resampling instead of filter
+				     based.				    */
 };
 
Index: pjproject/trunk/pjmedia/include/pjmedia/config.h
===================================================================
--- pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 346)
+++ pjproject/trunk/pjmedia/include/pjmedia/config.h	(revision 347)
@@ -42,4 +42,7 @@
 /**
  * Unless specified otherwise, G711 codec is included by default.
+ * Note that there are parts of G711 codec (such as linear2ulaw) that are 
+ * needed by other PJMEDIA components (e.g. silence detector, conference).
+ * Thus disabling G711 is generally not a good idea.
  */
 #ifndef PJMEDIA_HAS_G711_CODEC
@@ -48,3 +51,22 @@
 
 
+/**
+ * Include small filter table in resample.
+ * This adds about 9KB in rdata.
+ */
+#ifndef PJMEDIA_HAS_SMALL_FILTER
+#   define PJMEDIA_HAS_SMALL_FILTER	    1
+#endif
+
+
+/**
+ * Include large filter table in resample.
+ * This adds about 32KB in rdata.
+ */
+#ifndef PJMEDIA_HAS_LARGE_FILTER
+#   define PJMEDIA_HAS_LARGE_FILTER	    1
+#endif
+
+
 #endif	/* __PJMEDIA_CONFIG_H__ */
+
Index: pjproject/trunk/pjmedia/src/pjmedia/conference.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 346)
+++ pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 347)
@@ -238,16 +238,19 @@
     if (conf_port->clock_rate != conf->clock_rate) {
 
-	double factor;
-
-	factor = 1.0 * conf_port->clock_rate / conf->clock_rate;
+	pj_bool_t high_quality;
+	pj_bool_t large_filter;
+
+	high_quality = ((conf->options & PJMEDIA_CONF_USE_LINEAR)==0);
+	large_filter = ((conf->options & PJMEDIA_CONF_SMALL_FILTER)==0);
 
 	/* Create resample for rx buffer. */
 	status = pjmedia_resample_create( pool, 
-					  PJ_TRUE,  /* High quality */
-					  PJ_TRUE,  /* Large filter */
+					  high_quality,
+					  large_filter,
 					  conf_port->clock_rate,/* Rate in */
 					  conf->clock_rate, /* Rate out */
-					  (unsigned)(conf->samples_per_frame * 
-						     factor),
+					  conf->samples_per_frame * 
+					    conf_port->clock_rate /
+					    conf->clock_rate,
 					  &conf_port->rx_resample);
 	if (status != PJ_SUCCESS)
@@ -257,6 +260,6 @@
 	/* Create resample for tx buffer. */
 	status = pjmedia_resample_create(pool,
-					 PJ_TRUE,   /* High quality */
-					 PJ_TRUE,   /* Large filter */
+					 high_quality,
+					 large_filter,
 					 conf->clock_rate,  /* Rate in */
 					 conf_port->clock_rate, /* Rate out */
Index: pjproject/trunk/pjmedia/src/pjmedia/largefilter.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/largefilter.h	(revision 346)
+++ pjproject/trunk/pjmedia/src/pjmedia/largefilter.h	(revision 347)
@@ -3,5 +3,5 @@
 #define LARGE_FILTER_SCALE 14746 /* Unity-gain scale factor */
 #define LARGE_FILTER_NWING 8192 /* Filter table length */
-static HWORD LARGE_FILTER_IMP[] /* Impulse response */ = {
+static const HWORD LARGE_FILTER_IMP[] /* Impulse response */ = {
 32767,
 32766,
@@ -8197,5 +8197,5 @@
 0};
 
-static HWORD LARGE_FILTER_IMPD[] /* Impulse response differences */ = {
+static const HWORD LARGE_FILTER_IMPD[] /* Impulse response differences */ = {
 -1,
 -2,
Index: pjproject/trunk/pjmedia/src/pjmedia/resample.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/resample.c	(revision 346)
+++ pjproject/trunk/pjmedia/src/pjmedia/resample.c	(revision 347)
@@ -66,6 +66,9 @@
 #include <pjmedia/errno.h>
 #include <pj/assert.h>
+#include <pj/log.h>
 #include <pj/pool.h>
 
+
+#define THIS_FILE   "resample.c"
 
 
@@ -192,6 +195,24 @@
 #endif
 
-#include "smallfilter.h"
-#include "largefilter.h"
+#if defined(PJMEDIA_HAS_SMALL_FILTER) && PJMEDIA_HAS_SMALL_FILTER!=0
+#   include "smallfilter.h"
+#else
+#   define SMALL_FILTER_NMULT	0
+#   define SMALL_FILTER_SCALE	0
+#   define SMALL_FILTER_NWING	0
+#   define SMALL_FILTER_IMP	NULL
+#   define SMALL_FILTER_IMPD	NULL
+#endif
+
+#if defined(PJMEDIA_HAS_LARGE_FILTER) && PJMEDIA_HAS_LARGE_FILTER!=0
+#   include "largefilter.h"
+#else
+#   define LARGE_FILTER_NMULT	0
+#   define LARGE_FILTER_SCALE	0
+#   define LARGE_FILTER_NWING	0
+#   define LARGE_FILTER_IMP	NULL
+#   define LARGE_FILTER_IMPD	NULL
+#endif
+
 
 #undef INLINE
@@ -481,4 +502,29 @@
     }
 
+#if !defined(PJMEDIA_HAS_LARGE_FILTER) || PJMEDIA_HAS_LARGE_FILTER==0
+    /*
+     * If large filter is excluded in the build, then prevent application
+     * from using it.
+     */
+    if (high_quality && large_filter) {
+	large_filter = PJ_FALSE;
+	PJ_LOG(5,(THIS_FILE, 
+		  "Resample uses small filter because large filter is "
+		  "disabled"));
+    }
+#endif
+
+#if !defined(PJMEDIA_HAS_SMALL_FILTER) || PJMEDIA_HAS_SMALL_FILTER==0
+    /*
+     * If small filter is excluded in the build and application wants to
+     * use it, then drop to linear conversion.
+     */
+    if (high_quality && large_filter == 0) {
+	high_quality = PJ_FALSE;
+	PJ_LOG(4,(THIS_FILE, 
+		  "Resample uses linear because small filter is disabled"));
+    }
+#endif
+
     resample->factor = rate_out * 1.0 / rate_in;
     resample->large_filter = large_filter;
Index: pjproject/trunk/pjmedia/src/pjmedia/smallfilter.h
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/smallfilter.h	(revision 346)
+++ pjproject/trunk/pjmedia/src/pjmedia/smallfilter.h	(revision 347)
@@ -3,5 +3,5 @@
 #define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */
 #define SMALL_FILTER_NWING 1536 /* Filter table length */
-static HWORD SMALL_FILTER_IMP[] /* Impulse response */ = {
+static const HWORD SMALL_FILTER_IMP[] /* Impulse response */ = {
 32767,
 32766,
@@ -1542,5 +1542,5 @@
 };
 
-static HWORD SMALL_FILTER_IMPD[] = {
+static const HWORD SMALL_FILTER_IMPD[] = {
 -1,
 -2,
Index: pjproject/trunk/pjsip-apps/build/samples.dsp
===================================================================
--- pjproject/trunk/pjsip-apps/build/samples.dsp	(revision 346)
+++ pjproject/trunk/pjsip-apps/build/samples.dsp	(revision 347)
@@ -91,4 +91,8 @@
 # Begin Source File
 
+SOURCE=..\src\samples\level.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\src\samples\playfile.c
 # End Source File
@@ -100,4 +104,8 @@
 
 SOURCE=..\src\samples\simpleua.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\samples\sndinfo.c
 # End Source File
 # End Group
