Changeset 6119
- Timestamp:
- Dec 17, 2019 10:06:01 AM (5 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp
r6094 r6119 1554 1554 */ 1555 1555 void resetVideoCodecParam(const string &codec_id) PJSUA2_THROW(Error); 1556 1557 #if defined(PJMEDIA_HAS_OPUS_CODEC) && (PJMEDIA_HAS_OPUS_CODEC!=0) 1558 /** 1559 * Get codec Opus config. 1560 * 1561 */ 1562 CodecOpusConfig getCodecOpusConfig() const PJSUA2_THROW(Error); 1563 1564 /** 1565 * Set codec Opus config. 1566 * 1567 * @param opus_cfg Codec Opus configuration. 1568 * 1569 */ 1570 void setCodecOpusConfig(const CodecOpusConfig &opus_cfg) 1571 PJSUA2_THROW(Error); 1572 #endif 1556 1573 1557 1574 /** -
pjproject/trunk/pjsip/include/pjsua2/media.hpp
r6117 r6119 2442 2442 2443 2443 /** 2444 * Opus codec parameters setting; 2445 */ 2446 struct CodecOpusConfig 2447 { 2448 unsigned sample_rate; /**< Sample rate in Hz. */ 2449 unsigned channel_cnt; /**< Number of channels. */ 2450 unsigned frm_ptime; /**< Frame time in msec. */ 2451 unsigned bit_rate; /**< Encoder bit rate in bps. */ 2452 unsigned packet_loss; /**< Encoder's expected packet loss pct. */ 2453 unsigned complexity; /**< Encoder complexity, 0-10(10 is highest)*/ 2454 bool cbr; /**< Constant bit rate? */ 2455 2456 pjmedia_codec_opus_config toPj() const; 2457 void fromPj(const pjmedia_codec_opus_config &config); 2458 }; 2459 2460 /** 2444 2461 * Detailed codec attributes used in configuring a video codec and in querying 2445 2462 * the capability of video codec factories. -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r6081 r6119 2221 2221 } 2222 2222 2223 #if defined(PJMEDIA_HAS_OPUS_CODEC) && (PJMEDIA_HAS_OPUS_CODEC!=0) 2224 2225 CodecOpusConfig Endpoint::getCodecOpusConfig() const PJSUA2_THROW(Error) 2226 { 2227 pjmedia_codec_opus_config opus_cfg; 2228 CodecOpusConfig config; 2229 2230 PJSUA2_CHECK_EXPR(pjmedia_codec_opus_get_config(&opus_cfg)); 2231 config.fromPj(opus_cfg); 2232 2233 return config; 2234 } 2235 2236 void Endpoint::setCodecOpusConfig(const CodecOpusConfig &opus_cfg) 2237 PJSUA2_THROW(Error) 2238 { 2239 const pj_str_t codec_id = {"opus", 4}; 2240 pjmedia_codec_param param; 2241 pjmedia_codec_opus_config new_opus_cfg; 2242 2243 PJSUA2_CHECK_EXPR(pjsua_codec_get_param(&codec_id, ¶m)); 2244 2245 PJSUA2_CHECK_EXPR(pjmedia_codec_opus_get_config(&new_opus_cfg)); 2246 2247 new_opus_cfg = opus_cfg.toPj(); 2248 2249 PJSUA2_CHECK_EXPR(pjmedia_codec_opus_set_default_param(&new_opus_cfg, 2250 ¶m)); 2251 } 2252 2253 #endif 2254 2223 2255 void Endpoint::clearCodecInfoList(CodecInfoVector &codec_list) 2224 2256 { -
pjproject/trunk/pjsip/src/pjsua2/media.cpp
r6117 r6119 1824 1824 } 1825 1825 1826 pjmedia_codec_opus_config CodecOpusConfig::toPj() const 1827 { 1828 pjmedia_codec_opus_config config; 1829 1830 config.sample_rate = sample_rate; 1831 config.channel_cnt = channel_cnt; 1832 config.frm_ptime = frm_ptime; 1833 config.bit_rate = bit_rate; 1834 config.packet_loss = packet_loss; 1835 config.complexity = complexity; 1836 config.cbr = cbr; 1837 1838 return config; 1839 } 1840 1841 void CodecOpusConfig::fromPj(const pjmedia_codec_opus_config &config) 1842 { 1843 sample_rate = config.sample_rate; 1844 channel_cnt = config.channel_cnt; 1845 frm_ptime = config.frm_ptime; 1846 bit_rate = config.bit_rate; 1847 packet_loss = config.packet_loss; 1848 complexity = config.complexity; 1849 cbr = config.cbr; 1850 } 1851 1826 1852 /////////////////////////////////////////////////////////////////////////////// 1827 1853 void VidCodecParam::fromPj(const pjmedia_vid_codec_param ¶m)
Note: See TracChangeset
for help on using the changeset viewer.