Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1822)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 1823)
@@ -172,5 +172,6 @@
     puts  ("  --add-codec=name    Manually add codec (default is to enable all)");
     puts  ("  --dis-codec=name    Disable codec (can be specified multiple times)");
-    puts  ("  --clock-rate=N      Override sound device clock rate");
+    puts  ("  --clock-rate=N      Override conference bridge clock rate");
+    puts  ("  --snd-clock-rate=N  Override sound device clock rate");
     puts  ("  --null-audio        Use NULL audio device");
     puts  ("  --play-file=file    Register WAV file in conference bridge.");
@@ -387,6 +388,6 @@
 	   OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE,
 	   OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP,
-	   OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, OPT_USE_SRTP, 
-	   OPT_SRTP_SECURE,
+	   OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_SND_CLOCK_RATE, OPT_USE_ICE,
+	   OPT_USE_SRTP, OPT_SRTP_SECURE,
 	   OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 
 	   OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC,
@@ -410,4 +411,5 @@
 	{ "version",	0, 0, OPT_VERSION},
 	{ "clock-rate",	1, 0, OPT_CLOCK_RATE},
+	{ "snd-clock-rate",	1, 0, OPT_SND_CLOCK_RATE},
 	{ "null-audio", 0, 0, OPT_NULL_AUDIO},
 	{ "local-port", 1, 0, OPT_LOCAL_PORT},
@@ -563,8 +565,18 @@
 	    if (lval < 8000 || lval > 48000) {
 		PJ_LOG(1,(THIS_FILE, "Error: expecting value between "
-				     "8000-48000 for clock rate"));
+				     "8000-48000 for conference clock rate"));
 		return PJ_EINVAL;
 	    }
 	    cfg->media_cfg.clock_rate = lval; 
+	    break;
+
+	case OPT_SND_CLOCK_RATE:
+	    lval = pj_strtoul(pj_cstr(&tmp, pj_optarg));
+	    if (lval < 8000 || lval > 48000) {
+		PJ_LOG(1,(THIS_FILE, "Error: expecting value between "
+				     "8000-48000 for sound device clock rate"));
+		return PJ_EINVAL;
+	    }
+	    cfg->media_cfg.snd_clock_rate = lval; 
 	    break;
 
@@ -1386,4 +1398,14 @@
 	pj_ansi_sprintf(line, "#using default --clock-rate %d\n",
 			config->media_cfg.clock_rate);
+	pj_strcat2(&cfg, line);
+    }
+
+    if (config->media_cfg.snd_clock_rate != config->media_cfg.clock_rate) {
+	pj_ansi_sprintf(line, "--snd-clock-rate %d\n",
+			config->media_cfg.snd_clock_rate);
+	pj_strcat2(&cfg, line);
+    } else {
+	pj_ansi_sprintf(line, "#using default --snd-clock-rate %d\n",
+			config->media_cfg.snd_clock_rate);
 	pj_strcat2(&cfg, line);
     }
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 1822)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 1823)
@@ -3743,4 +3743,10 @@
 
     /**
+     * Clock rate to be applied when opening the sound device.
+     * If value is zero, conference bridge clock rate will be used.
+     */
+    unsigned		snd_clock_rate;
+
+    /**
      * Specify audio frame ptime. The value here will affect the 
      * samples per frame of both the sound device and the conference
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1822)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1823)
@@ -163,4 +163,5 @@
 
     cfg->clock_rate = PJSUA_DEFAULT_CLOCK_RATE;
+    cfg->snd_clock_rate = PJSUA_DEFAULT_CLOCK_RATE;
     cfg->audio_frame_ptime = PJSUA_DEFAULT_AUDIO_FRAME_PTIME;
     cfg->max_media_ports = PJSUA_MAX_CONF_PORTS;
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 1822)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c	(revision 1823)
@@ -1772,5 +1772,6 @@
     pjmedia_port *conf_port;
     const pjmedia_snd_dev_info *play_info;
-    unsigned clock_rates[] = { 0, 22050, 44100, 48000, 11025, 32000, 8000};
+    unsigned clock_rates[] = {0, 22050, 44100, 48000, 32000, 16000, 
+			      8000};
     unsigned selected_clock_rate = 0;
     unsigned i;
@@ -1785,5 +1786,7 @@
 
     /* Set default clock rate */
-    clock_rates[0] = pjsua_var.media_cfg.clock_rate;
+    clock_rates[0] = pjsua_var.media_cfg.snd_clock_rate;
+    if (clock_rates[0] == 0)
+	clock_rates[0] = pjsua_var.media_cfg.clock_rate;
 
     /* Attempts to open the sound device with different clock rates */
@@ -1832,8 +1835,18 @@
     if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) {
 	pjmedia_port *resample_port;
-
+	unsigned resample_opt = 0;
+
+	if (pjsua_var.media_cfg.quality >= 3 &&
+	    pjsua_var.media_cfg.quality <= 4)
+	{
+	    resample_opt |= PJMEDIA_CONF_SMALL_FILTER;
+	}
+	else if (pjsua_var.media_cfg.quality < 3) {
+	    resample_opt |= PJMEDIA_CONF_USE_LINEAR;
+	}
+	
 	status = pjmedia_resample_port_create(pjsua_var.pool, conf_port, 
-					      selected_clock_rate, 0, 
-					      &resample_port);
+					      selected_clock_rate, 
+					      resample_opt, &resample_port);
 	if (status != PJ_SUCCESS) {
 	    pjsua_perror("Error creating resample port", THIS_FILE, status);
@@ -1864,6 +1877,16 @@
     play_info = pjmedia_snd_get_dev_info(si.rec_id);
 
-    pjmedia_conf_set_port0_name(pjsua_var.mconf, 
-				pj_cstr(&tmp, play_info->name));
+    if (si.clock_rate != pjsua_var.media_cfg.clock_rate) {
+	char tmp_buf[128];
+	int tmp_buf_len = sizeof(tmp_buf);
+
+	tmp_buf_len = pj_ansi_snprintf(tmp_buf, sizeof(tmp_buf)-1, "%s (%dKHz)",
+				       play_info->name, si.clock_rate/1000);
+	pj_strset(&tmp, tmp_buf, tmp_buf_len);
+        pjmedia_conf_set_port0_name(pjsua_var.mconf, &tmp); 
+    } else {
+        pjmedia_conf_set_port0_name(pjsua_var.mconf, 
+				    pj_cstr(&tmp, play_info->name));
+    }
 
     return PJ_SUCCESS;
