- Timestamp:
- Mar 11, 2008 1:15:43 PM (17 years ago)
- Location:
- pjproject/trunk/pjsip/src/pjsua-lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r1823 r1855 163 163 164 164 cfg->clock_rate = PJSUA_DEFAULT_CLOCK_RATE; 165 cfg->snd_clock_rate = PJSUA_DEFAULT_CLOCK_RATE;165 cfg->snd_clock_rate = 0; 166 166 cfg->audio_frame_ptime = PJSUA_DEFAULT_AUDIO_FRAME_PTIME; 167 167 cfg->max_media_ports = PJSUA_MAX_CONF_PORTS; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r1823 r1855 53 53 54 54 /* Normalize configuration */ 55 if (pjsua_var.media_cfg.snd_clock_rate == 0) { 56 pjsua_var.media_cfg.snd_clock_rate = pjsua_var.media_cfg.clock_rate; 57 } 55 58 56 59 if (pjsua_var.media_cfg.has_ioqueue && … … 185 188 opt, &pjsua_var.mconf); 186 189 if (status != PJ_SUCCESS) { 187 pjsua_perror(THIS_FILE, 188 "Media stack initialization has returned error", 190 pjsua_perror(THIS_FILE, "Error creating conference bridge", 189 191 status); 190 192 return status; … … 1790 1792 clock_rates[0] = pjsua_var.media_cfg.clock_rate; 1791 1793 1794 /* Get the port0 of the conference bridge. */ 1795 conf_port = pjmedia_conf_get_master_port(pjsua_var.mconf); 1796 pj_assert(conf_port != NULL); 1797 1792 1798 /* Attempts to open the sound device with different clock rates */ 1793 1799 for (i=0; i<PJ_ARRAY_SIZE(clock_rates); ++i) { … … 1809 1815 if (status == PJ_SUCCESS) { 1810 1816 selected_clock_rate = clock_rates[i]; 1811 break; 1817 1818 /* If there's mismatch between sound port and conference's port, 1819 * create a resample port to bridge them. 1820 */ 1821 if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) { 1822 pjmedia_port *resample_port; 1823 unsigned resample_opt = 0; 1824 1825 if (pjsua_var.media_cfg.quality >= 3 && 1826 pjsua_var.media_cfg.quality <= 4) 1827 { 1828 resample_opt |= PJMEDIA_CONF_SMALL_FILTER; 1829 } 1830 else if (pjsua_var.media_cfg.quality < 3) { 1831 resample_opt |= PJMEDIA_CONF_USE_LINEAR; 1832 } 1833 1834 status = pjmedia_resample_port_create(pjsua_var.pool, 1835 conf_port, 1836 selected_clock_rate, 1837 resample_opt, 1838 &resample_port); 1839 if (status != PJ_SUCCESS) { 1840 pj_strerror(status, errmsg, sizeof(errmsg)); 1841 PJ_LOG(4, (THIS_FILE, 1842 "Error creating resample port, trying next " 1843 "clock rate", 1844 errmsg)); 1845 pjmedia_snd_port_destroy(pjsua_var.snd_port); 1846 pjsua_var.snd_port = NULL; 1847 continue; 1848 } else { 1849 conf_port = resample_port; 1850 break; 1851 } 1852 1853 } else { 1854 break; 1855 } 1812 1856 } 1813 1857 … … 1820 1864 return status; 1821 1865 } 1822 1823 /* Get the port0 of the conference bridge. */1824 conf_port = pjmedia_conf_get_master_port(pjsua_var.mconf);1825 pj_assert(conf_port != NULL);1826 1866 1827 1867 /* Set AEC */ … … 1829 1869 pjsua_var.media_cfg.ec_tail_len, 1830 1870 pjsua_var.media_cfg.ec_options); 1831 1832 /* If there's mismatch between sound port and conference's port,1833 * create a resample port to bridge them.1834 */1835 if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) {1836 pjmedia_port *resample_port;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 1848 status = pjmedia_resample_port_create(pjsua_var.pool, conf_port,1849 selected_clock_rate,1850 resample_opt, &resample_port);1851 if (status != PJ_SUCCESS) {1852 pjsua_perror("Error creating resample port", THIS_FILE, status);1853 return status;1854 }1855 1856 conf_port = resample_port;1857 }1858 1871 1859 1872 /* Connect sound port to the bridge */
Note: See TracChangeset
for help on using the changeset viewer.