Changeset 5239
- Timestamp:
- Feb 4, 2016 6:11:58 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/aconfigure
r5199 r5239 624 624 ac_host 625 625 ac_linux_poll 626 opus_present 627 opus_h_present 628 ac_no_opus 626 629 silk_present 627 630 silk_h_present … … 817 820 with_silk 818 821 enable_silk 822 with_opus 823 enable_opus 819 824 ' 820 825 ac_precious_vars='build_alias … … 1481 1486 1482 1487 --disable-silk Exclude SILK support from the build (default: 1488 autodetect) 1489 1490 --disable-opus Exclude OPUS support from the build (default: 1483 1491 autodetect) 1484 1492 … … 1524 1532 Specify alternate libvo-amrwbenc prefix 1525 1533 --with-silk=DIR Specify alternate SILK prefix 1534 --with-opus=DIR Specify alternate OPUS prefix 1526 1535 1527 1536 Some influential environment variables: … … 8227 8236 8228 8237 8238 if test "x$ac_cross_compile" != "x" -a "x$with_opus" = "xno"; then 8239 enable_opus=no 8240 fi 8241 8242 8243 # Check whether --with-opus was given. 8244 if test "${with_opus+set}" = set; then : 8245 withval=$with_opus; 8246 else 8247 with_opus=no 8248 8249 fi 8250 8251 8252 8253 # Check whether --enable-opus was given. 8254 if test "${enable_opus+set}" = set; then : 8255 enableval=$enable_opus; 8256 if test "$enable_opus" = "no"; then 8257 ac_no_opus=1 8258 $as_echo "#define PJMEDIA_HAS_OPUS_CODEC 0" >>confdefs.h 8259 8260 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if OPUS support is disabled... yes" >&5 8261 $as_echo "Checking if OPUS support is disabled... yes" >&6; } 8262 fi 8263 8264 else 8265 8266 { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for OPUS installations.." >&5 8267 $as_echo "checking for OPUS installations.." >&6; } 8268 if test "x$with_opus" != "xno" -a "x$with_opus" != "x"; then 8269 CFLAGS="$CFLAGS -I$with_opus/include" 8270 CPPFLAGS="$CPPFLAGS -I$with_opus/include" 8271 LDFLAGS="$LDFLAGS -L$with_opus/lib" 8272 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using OPUS prefix... $with_opus" >&5 8273 $as_echo "Using OPUS prefix... $with_opus" >&6; } 8274 fi 8275 8276 8277 ac_fn_c_check_header_mongrel "$LINENO" "opus/opus.h" "ac_cv_header_opus_opus_h" "$ac_includes_default" 8278 if test "x$ac_cv_header_opus_opus_h" = xyes; then : 8279 opus_h_present=1 8280 fi 8281 8282 8283 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opus_repacketizer_get_size in -lopus" >&5 8284 $as_echo_n "checking for opus_repacketizer_get_size in -lopus... " >&6; } 8285 if ${ac_cv_lib_opus_opus_repacketizer_get_size+:} false; then : 8286 $as_echo_n "(cached) " >&6 8287 else 8288 ac_check_lib_save_LIBS=$LIBS 8289 LIBS="-lopus $LIBS" 8290 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8291 /* end confdefs.h. */ 8292 8293 /* Override any GCC internal prototype to avoid an error. 8294 Use char because int might match the return type of a GCC 8295 builtin and then its argument prototype would still apply. */ 8296 #ifdef __cplusplus 8297 extern "C" 8298 #endif 8299 char opus_repacketizer_get_size (); 8300 int 8301 main () 8302 { 8303 return opus_repacketizer_get_size (); 8304 ; 8305 return 0; 8306 } 8307 _ACEOF 8308 if ac_fn_c_try_link "$LINENO"; then : 8309 ac_cv_lib_opus_opus_repacketizer_get_size=yes 8310 else 8311 ac_cv_lib_opus_opus_repacketizer_get_size=no 8312 fi 8313 rm -f core conftest.err conftest.$ac_objext \ 8314 conftest$ac_exeext conftest.$ac_ext 8315 LIBS=$ac_check_lib_save_LIBS 8316 fi 8317 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_opus_opus_repacketizer_get_size" >&5 8318 $as_echo "$ac_cv_lib_opus_opus_repacketizer_get_size" >&6; } 8319 if test "x$ac_cv_lib_opus_opus_repacketizer_get_size" = xyes; then : 8320 opus_present=1 && LIBS="$LIBS -lopus" 8321 fi 8322 8323 if test "x$opus_h_present" = "x1" -a "x$opus_present" = "x1"; then 8324 { $as_echo "$as_me:${as_lineno-$LINENO}: result: OPUS library found, OPUS support enabled" >&5 8325 $as_echo "OPUS library found, OPUS support enabled" >&6; } 8326 $as_echo "#define PJMEDIA_HAS_OPUS_CODEC 1" >>confdefs.h 8327 8328 else 8329 ac_no_opus=1 8330 { $as_echo "$as_me:${as_lineno-$LINENO}: result: OPUS library not found, OPUS support disabled" >&5 8331 $as_echo "OPUS library not found, OPUS support disabled" >&6; } 8332 $as_echo "#define PJMEDIA_HAS_OPUS_CODEC 0" >>confdefs.h 8333 8334 fi 8335 8336 fi 8337 8338 8229 8339 8230 8340 -
pjproject/trunk/aconfigure.ac
r5199 r5239 1762 1762 ]) 1763 1763 1764 dnl # Do not use default OPUS installation if we are cross-compiling 1765 if test "x$ac_cross_compile" != "x" -a "x$with_opus" = "xno"; then 1766 enable_opus=no 1767 fi 1768 1769 dnl # OPUS prefix 1770 AC_ARG_WITH(opus, 1771 AC_HELP_STRING([--with-opus=DIR], 1772 [Specify alternate OPUS prefix]), 1773 [], 1774 [with_opus=no] 1775 ) 1776 1777 dnl # Include OPUS support 1778 AC_SUBST(ac_no_opus) 1779 AC_ARG_ENABLE(opus, 1780 AC_HELP_STRING([--disable-opus], 1781 [Exclude OPUS support from the build (default: autodetect)]) 1782 , 1783 [ 1784 if test "$enable_opus" = "no"; then 1785 [ac_no_opus=1] 1786 AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,0) 1787 AC_MSG_RESULT([Checking if OPUS support is disabled... yes]) 1788 fi 1789 ], 1790 [ 1791 AC_MSG_RESULT([checking for OPUS installations..]) 1792 if test "x$with_opus" != "xno" -a "x$with_opus" != "x"; then 1793 CFLAGS="$CFLAGS -I$with_opus/include" 1794 CPPFLAGS="$CPPFLAGS -I$with_opus/include" 1795 LDFLAGS="$LDFLAGS -L$with_opus/lib" 1796 AC_MSG_RESULT([Using OPUS prefix... $with_opus]) 1797 fi 1798 AC_SUBST(opus_h_present) 1799 AC_SUBST(opus_present) 1800 AC_CHECK_HEADER(opus/opus.h,[opus_h_present=1]) 1801 AC_CHECK_LIB(opus,opus_repacketizer_get_size,[opus_present=1 && LIBS="$LIBS -lopus"]) 1802 if test "x$opus_h_present" = "x1" -a "x$opus_present" = "x1"; then 1803 AC_MSG_RESULT([OPUS library found, OPUS support enabled]) 1804 AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,1) 1805 else 1806 [ac_no_opus=1] 1807 AC_MSG_RESULT([OPUS library not found, OPUS support disabled]) 1808 AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,0) 1809 fi 1810 ]) 1811 1764 1812 1765 1813 dnl ########################################## -
pjproject/trunk/pjmedia/build/Makefile
r5186 r5239 139 139 h263_packetizer.o h264_packetizer.o \ 140 140 $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ 141 ipp_codecs.o silk.o $(CODEC_OBJS) \141 ipp_codecs.o silk.o opus.o $(CODEC_OBJS) \ 142 142 g7221_sdp_match.o amr_sdp_match.o 143 143 export PJMEDIA_CODEC_CFLAGS += $(_CFLAGS) $(GSM_CFLAGS) $(SPEEX_CFLAGS) \ -
pjproject/trunk/pjmedia/include/pjmedia-codec.h
r4815 r5239 39 39 #include <pjmedia-codec/passthrough.h> 40 40 #include <pjmedia-codec/silk.h> 41 #include <pjmedia-codec/opus.h> 41 42 42 43 -
pjproject/trunk/pjmedia/include/pjmedia-codec/config.h
r4331 r5239 421 421 422 422 /** 423 * Enable OPUS codec. 424 * 425 * Default: 0 426 */ 427 #ifndef PJMEDIA_HAS_OPUS_CODEC 428 # define PJMEDIA_HAS_OPUS_CODEC 0 429 #endif 430 431 /** 432 * OPUS codec sample rate. 433 * 434 * Default: 48000 435 */ 436 #ifndef PJMEDIA_CODEC_OPUS_DEFAULT_SAMPLE_RATE 437 # define PJMEDIA_CODEC_OPUS_DEFAULT_SAMPLE_RATE 48000 438 #endif 439 440 /** 441 * OPUS codec default maximum average bit rate. 442 * 443 * Default: 0 (leave it to default value specified by Opus, which will 444 * take into account factors such as media content (speech/music), sample 445 * rate, channel count, etc). 446 */ 447 #ifndef PJMEDIA_CODEC_OPUS_DEFAULT_BIT_RATE 448 # define PJMEDIA_CODEC_OPUS_DEFAULT_BIT_RATE 0 449 #endif 450 451 452 /** 453 * OPUS default encoding complexity, which is an integer from 454 * 0 to 10, where 0 is the lowest complexity and 10 is the highest. 455 * 456 * Default: 5 457 */ 458 #ifndef PJMEDIA_CODEC_OPUS_DEFAULT_COMPLEXITY 459 # define PJMEDIA_CODEC_OPUS_DEFAULT_COMPLEXITY 5 460 #endif 461 462 463 /** 464 * OPUS default CBR (constant bit rate) setting 465 * 466 * Default: PJ_FALSE (which means Opus will use VBR (variable bit rate)) 467 */ 468 #ifndef PJMEDIA_CODEC_OPUS_DEFAULT_CBR 469 # define PJMEDIA_CODEC_OPUS_DEFAULT_CBR PJ_FALSE 470 #endif 471 472 /** 423 473 * Specify if FFMPEG codecs are available. 424 474 * -
pjproject/trunk/pjmedia/include/pjmedia-codec/config_auto.h.in
r4331 r5239 85 85 #endif 86 86 87 /* OPUS codec */ 88 #ifndef PJMEDIA_HAS_OPUS_CODEC 89 #undef PJMEDIA_HAS_OPUS_CODEC 90 #endif 91 87 92 #endif /* __PJMEDIA_CODEC_CONFIG_AUTO_H_ */ 88 93 -
pjproject/trunk/pjmedia/include/pjmedia-codec/types.h
r4264 r5239 84 84 PJMEDIA_RTP_PT_G7221_RSV1, /**< G722.1 reserve */ 85 85 PJMEDIA_RTP_PT_G7221_RSV2, /**< G722.1 reserve */ 86 PJMEDIA_RTP_PT_OPUS, /**< OPUS */ 86 87 PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */ 87 88 PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */ -
pjproject/trunk/pjmedia/include/pjmedia/config.h
r5186 r5239 973 973 * - G.722 : RFC 3551 4.5.2 974 974 * - MPEG audio : RFC 3551 4.5.13 & RFC 3119 975 * - OPUS : RFC 7587 975 976 * 976 977 * Also when this feature is enabled, some handling will be performed -
pjproject/trunk/pjmedia/src/pjmedia-codec/audio_codecs.c
r4335 r5239 122 122 #endif 123 123 124 #if PJMEDIA_HAS_OPUS_CODEC 125 /* Register OPUS */ 126 status = pjmedia_codec_opus_init(endpt); 127 if (status != PJ_SUCCESS) 128 return status; 129 #endif 130 124 131 return PJ_SUCCESS; 125 132 } -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r5234 r5239 2110 2110 2111 2111 /* Open the codec. */ 2112 2113 /* The clock rate for Opus codec is not static, 2114 * it's negotiated in the SDP. 2115 */ 2116 if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 2117 stream->codec_param.info.clock_rate = info->fmt.clock_rate; 2118 stream->codec_param.info.channel_cnt = info->fmt.channel_cnt; 2119 } 2120 2112 2121 status = pjmedia_codec_open(stream->codec, &stream->codec_param); 2113 2122 if (status != PJ_SUCCESS) … … 2224 2233 /* RTP clock rate = 1/2 real clock rate */ 2225 2234 stream->rtp_tx_ts_len_per_pkt >>= 1; 2235 } else if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 2236 unsigned opus_ts_modifier = 48000 / afd->clock_rate; 2237 stream->rtp_rx_check_cnt = 0; 2238 stream->has_g722_mpeg_bug = PJ_TRUE; 2239 stream->rtp_tx_ts_len_per_pkt *= opus_ts_modifier; 2240 stream->rtp_rx_ts_len_per_frame *= opus_ts_modifier; 2226 2241 } 2227 2242 #endif -
pjproject/trunk/pjmedia/src/pjmedia/stream_info.c
r4930 r5239 34 34 static const pj_str_t ID_TELEPHONE_EVENT = { "telephone-event", 15 }; 35 35 36 static void get_opus_channels_and_clock_rate(const pjmedia_codec_fmtp *enc_fmtp, 37 const pjmedia_codec_fmtp *dec_fmtp, 38 unsigned *channel_cnt, 39 unsigned *clock_rate) 40 { 41 unsigned i; 42 unsigned enc_channel_cnt = 0, local_channel_cnt = 0; 43 unsigned enc_clock_rate = 0, local_clock_rate = 0; 44 45 for (i = 0; i < dec_fmtp->cnt; ++i) { 46 if (!pj_stricmp2(&dec_fmtp->param[i].name, "sprop-maxcapturerate")) { 47 local_clock_rate = (unsigned)pj_strtoul(&dec_fmtp->param[i].val); 48 } else if (!pj_stricmp2(&dec_fmtp->param[i].name, "sprop-stereo")) { 49 local_channel_cnt = (unsigned)pj_strtoul(&dec_fmtp->param[i].val); 50 local_channel_cnt = (local_channel_cnt > 0) ? 2 : 1; 51 } 52 } 53 if (!local_clock_rate) local_clock_rate = *clock_rate; 54 if (!local_channel_cnt) local_channel_cnt = *channel_cnt; 55 56 for (i = 0; i < enc_fmtp->cnt; ++i) { 57 if (!pj_stricmp2(&enc_fmtp->param[i].name, "maxplaybackrate")) { 58 enc_clock_rate = (unsigned)pj_strtoul(&enc_fmtp->param[i].val); 59 } else if (!pj_stricmp2(&enc_fmtp->param[i].name, "stereo")) { 60 enc_channel_cnt = (unsigned)pj_strtoul(&enc_fmtp->param[i].val); 61 enc_channel_cnt = (enc_channel_cnt > 0) ? 2 : 1; 62 } 63 } 64 /* The default is a standard mono session with 48000 Hz clock rate 65 * (RFC 7587, section 7) 66 */ 67 if (!enc_clock_rate) enc_clock_rate = 48000; 68 if (!enc_channel_cnt) enc_channel_cnt = 1; 69 70 *clock_rate = (enc_clock_rate < local_clock_rate) ? enc_clock_rate : 71 local_clock_rate; 72 73 *channel_cnt = (enc_channel_cnt < local_channel_cnt) ? enc_channel_cnt : 74 local_channel_cnt; 75 } 76 36 77 /* 37 78 * Internal function for collecting codec info and param from the SDP media. … … 218 259 pjmedia_stream_info_parse_fmtp(pool, local_m, si->rx_pt, 219 260 &si->param->setting.dec_fmtp); 261 262 if (!pj_stricmp2(&si->fmt.encoding_name, "opus")) { 263 get_opus_channels_and_clock_rate(&si->param->setting.enc_fmtp, 264 &si->param->setting.dec_fmtp, 265 &si->fmt.channel_cnt, 266 &si->fmt.clock_rate); 267 } 268 220 269 221 270 /* Get the remote ptime for our encoder. */
Note: See TracChangeset
for help on using the changeset viewer.