Changeset 1823
- Timestamp:
- Feb 26, 2008 3:32:16 PM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r1802 r1823 172 172 puts (" --add-codec=name Manually add codec (default is to enable all)"); 173 173 puts (" --dis-codec=name Disable codec (can be specified multiple times)"); 174 puts (" --clock-rate=N Override sound device clock rate"); 174 puts (" --clock-rate=N Override conference bridge clock rate"); 175 puts (" --snd-clock-rate=N Override sound device clock rate"); 175 176 puts (" --null-audio Use NULL audio device"); 176 177 puts (" --play-file=file Register WAV file in conference bridge."); … … 387 388 OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 388 389 OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 389 OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_ USE_ICE, OPT_USE_SRTP,390 OPT_ SRTP_SECURE,390 OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_SND_CLOCK_RATE, OPT_USE_ICE, 391 OPT_USE_SRTP, OPT_SRTP_SECURE, 391 392 OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 392 393 OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC, … … 410 411 { "version", 0, 0, OPT_VERSION}, 411 412 { "clock-rate", 1, 0, OPT_CLOCK_RATE}, 413 { "snd-clock-rate", 1, 0, OPT_SND_CLOCK_RATE}, 412 414 { "null-audio", 0, 0, OPT_NULL_AUDIO}, 413 415 { "local-port", 1, 0, OPT_LOCAL_PORT}, … … 563 565 if (lval < 8000 || lval > 48000) { 564 566 PJ_LOG(1,(THIS_FILE, "Error: expecting value between " 565 "8000-48000 for c lock rate"));567 "8000-48000 for conference clock rate")); 566 568 return PJ_EINVAL; 567 569 } 568 570 cfg->media_cfg.clock_rate = lval; 571 break; 572 573 case OPT_SND_CLOCK_RATE: 574 lval = pj_strtoul(pj_cstr(&tmp, pj_optarg)); 575 if (lval < 8000 || lval > 48000) { 576 PJ_LOG(1,(THIS_FILE, "Error: expecting value between " 577 "8000-48000 for sound device clock rate")); 578 return PJ_EINVAL; 579 } 580 cfg->media_cfg.snd_clock_rate = lval; 569 581 break; 570 582 … … 1386 1398 pj_ansi_sprintf(line, "#using default --clock-rate %d\n", 1387 1399 config->media_cfg.clock_rate); 1400 pj_strcat2(&cfg, line); 1401 } 1402 1403 if (config->media_cfg.snd_clock_rate != config->media_cfg.clock_rate) { 1404 pj_ansi_sprintf(line, "--snd-clock-rate %d\n", 1405 config->media_cfg.snd_clock_rate); 1406 pj_strcat2(&cfg, line); 1407 } else { 1408 pj_ansi_sprintf(line, "#using default --snd-clock-rate %d\n", 1409 config->media_cfg.snd_clock_rate); 1388 1410 pj_strcat2(&cfg, line); 1389 1411 } -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r1806 r1823 3743 3743 3744 3744 /** 3745 * Clock rate to be applied when opening the sound device. 3746 * If value is zero, conference bridge clock rate will be used. 3747 */ 3748 unsigned snd_clock_rate; 3749 3750 /** 3745 3751 * Specify audio frame ptime. The value here will affect the 3746 3752 * samples per frame of both the sound device and the conference -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r1815 r1823 163 163 164 164 cfg->clock_rate = PJSUA_DEFAULT_CLOCK_RATE; 165 cfg->snd_clock_rate = PJSUA_DEFAULT_CLOCK_RATE; 165 166 cfg->audio_frame_ptime = PJSUA_DEFAULT_AUDIO_FRAME_PTIME; 166 167 cfg->max_media_ports = PJSUA_MAX_CONF_PORTS; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r1810 r1823 1772 1772 pjmedia_port *conf_port; 1773 1773 const pjmedia_snd_dev_info *play_info; 1774 unsigned clock_rates[] = { 0, 22050, 44100, 48000, 11025, 32000, 8000}; 1774 unsigned clock_rates[] = {0, 22050, 44100, 48000, 32000, 16000, 1775 8000}; 1775 1776 unsigned selected_clock_rate = 0; 1776 1777 unsigned i; … … 1785 1786 1786 1787 /* Set default clock rate */ 1787 clock_rates[0] = pjsua_var.media_cfg.clock_rate; 1788 clock_rates[0] = pjsua_var.media_cfg.snd_clock_rate; 1789 if (clock_rates[0] == 0) 1790 clock_rates[0] = pjsua_var.media_cfg.clock_rate; 1788 1791 1789 1792 /* Attempts to open the sound device with different clock rates */ … … 1832 1835 if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) { 1833 1836 pjmedia_port *resample_port; 1834 1837 unsigned resample_opt = 0; 1838 1839 if (pjsua_var.media_cfg.quality >= 3 && 1840 pjsua_var.media_cfg.quality <= 4) 1841 { 1842 resample_opt |= PJMEDIA_CONF_SMALL_FILTER; 1843 } 1844 else if (pjsua_var.media_cfg.quality < 3) { 1845 resample_opt |= PJMEDIA_CONF_USE_LINEAR; 1846 } 1847 1835 1848 status = pjmedia_resample_port_create(pjsua_var.pool, conf_port, 1836 selected_clock_rate, 0,1837 &resample_port);1849 selected_clock_rate, 1850 resample_opt, &resample_port); 1838 1851 if (status != PJ_SUCCESS) { 1839 1852 pjsua_perror("Error creating resample port", THIS_FILE, status); … … 1864 1877 play_info = pjmedia_snd_get_dev_info(si.rec_id); 1865 1878 1866 pjmedia_conf_set_port0_name(pjsua_var.mconf, 1867 pj_cstr(&tmp, play_info->name)); 1879 if (si.clock_rate != pjsua_var.media_cfg.clock_rate) { 1880 char tmp_buf[128]; 1881 int tmp_buf_len = sizeof(tmp_buf); 1882 1883 tmp_buf_len = pj_ansi_snprintf(tmp_buf, sizeof(tmp_buf)-1, "%s (%dKHz)", 1884 play_info->name, si.clock_rate/1000); 1885 pj_strset(&tmp, tmp_buf, tmp_buf_len); 1886 pjmedia_conf_set_port0_name(pjsua_var.mconf, &tmp); 1887 } else { 1888 pjmedia_conf_set_port0_name(pjsua_var.mconf, 1889 pj_cstr(&tmp, play_info->name)); 1890 } 1868 1891 1869 1892 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.