Changeset 3175
- Timestamp:
- May 17, 2010 1:07:39 PM (14 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 12 edited
- 37 copied
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
/pjproject/branches/projects/iphone merged: 3129-3130,3137,3166,3168-3171
- Property svn:mergeinfo changed
-
pjproject/trunk/aconfigure
r3158 r3175 2284 2284 ac_config_headers="$ac_config_headers pjlib/include/pj/compat/os_auto.h pjlib/include/pj/compat/m_auto.h pjmedia/include/pjmedia/config_auto.h pjmedia/include/pjmedia-codec/config_auto.h pjsip/include/pjsip/sip_autoconf.h" 2285 2285 2286 ac_config_files="$ac_config_files build.mak build/os-auto.mak pjlib/build/os-auto.mak pjlib-util/build/os-auto.mak pjmedia/build/os-auto.mak pjsip/build/os-auto.mak third_party/build/os-auto.mak third_party/build/portaudio/os-auto.mak"2286 ac_config_files="$ac_config_files build.mak build/os-auto.mak build/cc-auto.mak pjlib/build/os-auto.mak pjlib-util/build/os-auto.mak pjmedia/build/os-auto.mak pjsip/build/os-auto.mak third_party/build/os-auto.mak third_party/build/portaudio/os-auto.mak" 2287 2287 2288 2288 … … 3327 3327 3328 3328 3329 if test "$AR" = ""; then AR="$(CROSS_COMPILE)ar rv"; fi 3330 3331 if test "$LD" = ""; then LD="$CC"; fi 3332 3333 if test "$LDOUT" = ""; then LDOUT="-o"; fi 3334 3335 if test "$RANLIB" = ""; then RANLIB="$(CROSSCOMPILE)ranlib"; fi 3336 3337 if test "$OBJEXT" = ""; then OBJEXT='o'; fi 3338 3339 if test "$LIBEXT" = ""; then LIBEXT='a'; fi 3340 3341 if test "$LIBEXT2" = ""; then LIBEXT2=""; fi 3342 3343 if test "$CC_OUT" = ""; then CC_OUT="-o"; fi 3344 3345 if test "$CC_INC" = ""; then CC_INC="-I"; fi 3346 3347 if test "$CC_DEF" = ""; then CC_DEF="-D"; fi 3348 3349 if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi 3350 3351 if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi 3352 3353 3354 3355 3329 3356 3330 3357 … … 5385 5412 else 5386 5413 case $target in 5414 arm-apple-darwin*) 5415 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox" 5416 { echo "$as_me:$LINENO: result: Checking sound device backend... AudioUnit" >&5 5417 echo "${ECHO_T}Checking sound device backend... AudioUnit" >&6; } 5418 ;; 5387 5419 *darwin*) 5388 5420 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox" … … 6851 6883 "build.mak") CONFIG_FILES="$CONFIG_FILES build.mak" ;; 6852 6884 "build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES build/os-auto.mak" ;; 6885 "build/cc-auto.mak") CONFIG_FILES="$CONFIG_FILES build/cc-auto.mak" ;; 6853 6886 "pjlib/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjlib/build/os-auto.mak" ;; 6854 6887 "pjlib-util/build/os-auto.mak") CONFIG_FILES="$CONFIG_FILES pjlib-util/build/os-auto.mak" ;; -
pjproject/trunk/aconfigure.ac
r3158 r3175 14 14 AC_CONFIG_FILES([build.mak 15 15 build/os-auto.mak 16 build/cc-auto.mak 16 17 pjlib/build/os-auto.mak 17 18 pjlib-util/build/os-auto.mak … … 34 35 CXXFLAGS="$CFLAGS $CXXFLAGS" 35 36 37 dnl # 38 dnl # Configure tools 39 dnl # 36 40 AC_PROG_CC 37 41 AC_PROG_CXX 38 42 AC_LANG_C 43 44 if test "$AR" = ""; then AR="$(CROSS_COMPILE)ar rv"; fi 45 AC_SUBST(AR) 46 if test "$LD" = ""; then LD="$CC"; fi 47 AC_SUBST(LD) 48 if test "$LDOUT" = ""; then LDOUT="-o"; fi 49 AC_SUBST(LDOUT) 50 if test "$RANLIB" = ""; then RANLIB="$(CROSSCOMPILE)ranlib"; fi 51 AC_SUBST(RANLIB) 52 if test "$OBJEXT" = ""; then OBJEXT='o'; fi 53 AC_SUBST(OBJEXT) 54 if test "$LIBEXT" = ""; then LIBEXT='a'; fi 55 AC_SUBST(LIBEXT) 56 if test "$LIBEXT2" = ""; then LIBEXT2=""; fi 57 AC_SUBST(LIBEXT2) 58 if test "$CC_OUT" = ""; then CC_OUT="-o"; fi 59 AC_SUBST(CC_OUT) 60 if test "$CC_INC" = ""; then CC_INC="-I"; fi 61 AC_SUBST(CC_INC) 62 if test "$CC_DEF" = ""; then CC_DEF="-D"; fi 63 AC_SUBST(CC_DEF) 64 if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi 65 AC_SUBST(CC_OPTIMIZE) 66 if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi 67 AC_SUBST(CC_CFLAGS) 68 69 39 70 40 71 AC_SUBST(ac_pjdir) … … 488 519 else 489 520 case $target in 521 arm-apple-darwin*) 522 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox" 523 AC_MSG_RESULT([Checking sound device backend... AudioUnit]) 524 ;; 490 525 *darwin*) 491 526 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox" -
pjproject/trunk/build
- Property svn:ignore
-
old new 2 2 *.opt 3 3 os-auto.mak 4 cc-auto.mak
-
- Property svn:ignore
-
pjproject/trunk/build.mak.in
r3063 r3175 61 61 # CFLAGS, LDFLAGS, and LIBS to be used by applications 62 62 export PJDIR := @ac_pjdir@ 63 export APP_CC := $(CROSS_COMPILE)$(CC_NAME) 63 export APP_CC := @CC@ 64 export APP_CXX := @CXX@ 64 65 export APP_CFLAGS := -DPJ_AUTOCONF=1\ 65 66 @CFLAGS@\ … … 106 107 export PJ_DIR := $(PJDIR) 107 108 export PJ_CC := $(APP_CC) 109 export PJ_CXX := $(APP_CXX) 108 110 export PJ_CFLAGS := $(APP_CFLAGS) 109 111 export PJ_CXXFLAGS := $(APP_CXXFLAGS) -
pjproject/trunk/build/common.mak
r1180 r3175 16 16 # 17 17 -include cc-$(CC_NAME).mak 18 19 # 20 # Include auto configured compiler specification. 21 # This will override the compiler settings above. 22 # Currently this is made OPTIONAL, to prevent people 23 # from getting errors because they don't re-run ./configure 24 # after downloading new PJSIP. 25 # 26 -include $(PJDIR)/build/cc-auto.mak 18 27 19 28 # -
pjproject/trunk/build/rules.mak
r2183 r3175 66 66 @echo $(APP)_LDFLAGS=$($(APP)_LDFLAGS) 67 67 @echo DEPFLAGS=$(DEPFLAGS) 68 @echo CC=$(CC) 69 @echo AR=$(AR) 70 @echo RANLIB=$(RANLIB) 68 71 69 72 print_bin: print_common -
pjproject/trunk/configure-iphone
r3168 r3175 1 1 #!/bin/bash 2 2 3 F="configure-iphone" 4 3 5 if test "$*" = "--help" -o "$*" = "-h"; then 4 echo " configure-iphone [SDK=name_path][OPTIONS]"6 echo "$F [OPTIONS]" 5 7 echo "" 6 echo "SDK=name_path Choose which SDK to use. Value can be SDK name (e.g." 7 echo " iPhoneOS2.2.1.sdk) or the full path of the SDK" 8 echo "OPTIONS Other options that will be passed directly to " 9 echo " ./aconfigure script. Run ./aconfigure --help for" 10 echo " more info." 8 echo "where:" 9 echo " OPTIONS Other options that will be passed directly to" 10 echo " ./aconfigure script. Run ./aconfigure --help" 11 echo " for more info." 12 echo "" 13 echo "Environment variables:" 14 echo " IPHONESDK Optionally specify which SDK to use. Value is the full " 15 echo " path of the SDK. By default, the latest SDK installed" 16 echo " will be used." 17 echo " CC Optionally specify the path of the ARM cross compiler" 18 echo " to use. By default, the compiler is deduced from the" 19 echo " SDK." 11 20 echo "" 12 21 exit 0 13 22 fi 14 23 15 F="configure-iphone"16 17 24 # Set the main iPhone developer directory, if not set 18 25 if test "x${DEVPATH}" = "x"; then 19 26 DEVPATH=/Developer/Platforms/iPhoneOS.platform/Developer 27 echo "$F: DEVPATH is not specified, using ${DEVPATH}" 20 28 fi 21 29 … … 27 35 28 36 # Choose SDK version to use 29 if test " x$SDK" = "x"; then30 # If SDK is not set, use the latest one37 if test "$IPHONESDK" = ""; then 38 # If IPHONESDK is not set, use the latest one 31 39 for f in `ls $DEVPATH/SDKs/`; do echo $f | sed 's/\(.sdk\)//'; done | sort | tail -1 > tmpsdkname 32 SDK=`cat tmpsdkname`.sdk40 IPHONESDK=`cat tmpsdkname`.sdk 33 41 rm -f tmpsdkname 34 echo "$F info: using ${SDK}"35 SDKPATH=${DEVPATH}/SDKs/${SDK}36 elif test -d ${ SDK}; then37 # .. else if SDK is set and it points to a valid path, just use it38 SDKPATH=${ SDK}42 SDKPATH=${DEVPATH}/SDKs/${IPHONESDK} 43 echo "$F: IPHONESDK is not specified, choosing ${IPHONESDK}" 44 elif test -d ${IPHONESDK}; then 45 # .. else if IPHONESDK is set and it points to a valid path, just use it 46 SDKPATH=${IPHONESDK} 39 47 else 40 48 # .. else assume the SDK name is used. 41 SDKPATH=${DEVPATH}/SDKs/${ SDK}49 SDKPATH=${DEVPATH}/SDKs/${IPHONESDK} 42 50 fi 43 51 … … 48 56 fi 49 57 50 # Settings to feed to configure script 51 export CFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH}" 52 export LDFLAGS="-O2 -arch armv6 -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation" 58 # Default CFLAGS if it's not specified 59 if test "$CFLAGS" = ""; then 60 CFLAGS="-O2 -Wno-unused-label" 61 fi 62 63 # Default LDFLAGS if it's not specified 64 if test "$LDFLAGS" = ""; then 65 LDFLAGS="-O2" 66 fi 67 68 # Determine which gcc for this SDK. Binaries should have the 69 # full path as it's not normally in user's PATH 70 71 if test "${CC}" = ""; then 72 for archpath in `ls -d ${SDKPATH}/usr/lib/gcc/arm-apple-darwin*`; do 73 archname=`basename ${archpath}` 74 for gccver in `ls ${archpath}`; do 75 gccpath="${DEVPATH}/usr/bin/${archname}-gcc-${gccver}" 76 if test -e ${gccpath}; then 77 export CC="${gccpath}" 78 break 79 fi 80 done 81 if test ! "${CC}" = ""; then 82 echo "$F: CC is not specified, choosing ${CC}" 83 break 84 fi 85 done 86 fi 87 88 if test "${CC}" = ""; then 89 echo "$F error: unable to find gcc for ${IPHONESDK}. If you think you have the right gcc, set the full path in CC environment variable." 90 exit 1 91 fi 92 93 # Set CXX if not set 94 if test "${CXX}" = ""; then 95 export CXX=`echo ${CC} | sed 's/gcc/g++/'` 96 echo "$F: CXX is not specified, using ${CXX}" 97 fi 98 99 # Other settings to feed to configure script. 100 #ARCH="-arch armv6" 101 export CFLAGS="${CFLAGS} ${ARCH} -isysroot ${SDKPATH}" 102 export LDFLAGS="${LDFLAGS} ${ARCH} -isysroot ${SDKPATH} -framework AudioToolbox -framework Foundation" 53 103 export AR="${DEVPATH}/usr/bin/libtool -static -o" 54 104 export RANLIB="echo ranlib" 55 105 # Use gcc -E as preprocessor instead of cpp, since cpp will find the 56 # header files in standard /usr/include 57 export CPP="${ DEVPATH}/usr/bin/arm-apple-darwin9-gcc-E -isysroot ${SDKPATH}"106 # header files in standard /usr/include instead of in isysroot 107 export CPP="${CC} -E -isysroot ${SDKPATH}" 58 108 59 # And finally invoke configure script itself 109 # Print settings 110 if test "1" = "1"; then 111 echo "$F: calling ./aconfigure with env vars:" 112 echo " CC = ${CC}" 113 echo " CXX = ${CXX}" 114 echo " SDKPATH = ${SDKPATH}" 115 echo " CFLAGS = ${CFLAGS}" 116 echo " LDFLAGS = ${LDFLAGS}" 117 echo " AR = ${AR}" 118 echo " RANLIB = ${RANLIB}" 119 fi 120 121 # And finally invoke the configure script itself 60 122 ./aconfigure --host=arm-apple-darwin9 --disable-floating-point $* 61 123 124 if test "$?" = "0"; then 125 echo "Done configuring for `basename $SDKPATH`" 126 echo "" 127 fi 128 -
pjproject/trunk/pjlib/include/pj/config_site_sample.h
r2833 r3175 295 295 #endif 296 296 297 /* 298 * iPhone sample settings. 299 */ 300 #if PJ_CONFIG_IPHONE 301 /* 302 * PJLIB settings. 303 */ 304 305 /* Disable floating point support */ 306 #define PJ_HAS_FLOATING_POINT 0 307 308 /* Misc PJLIB setting */ 309 #define PJ_MAXPATH 80 310 311 /* 312 * PJMEDIA settings 313 */ 314 315 /* We have our own native CoreAudio backend */ 316 #define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0 317 #define PJMEDIA_AUDIO_DEV_HAS_WMME 0 318 #define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 1 319 320 /* The CoreAudio backend has built-in echo canceller! */ 321 #define PJMEDIA_HAS_SPEEX_AEC 0 322 323 /* Disable some codecs */ 324 #define PJMEDIA_HAS_L16_CODEC 0 325 #define PJMEDIA_HAS_ILBC_CODEC 0 326 #define PJMEDIA_HAS_G722_CODEC 0 327 328 /* Fine tune Speex's default settings for best performance/quality */ 329 #define PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY 5 330 331 /* 332 * PJSIP settings. 333 */ 334 335 /* Increase allowable packet size, just in case */ 336 #define PJSIP_MAX_PKT_LEN 2000 337 338 /* 339 * PJSUA settings. 340 */ 341 342 /* Default codec quality, previously was set to 5, however it is now 343 * set to 4 to make sure pjsua instantiates resampler with small filter. 344 */ 345 #define PJSUA_DEFAULT_CODEC_QUALITY 4 346 347 /* Set maximum number of dialog/transaction/calls to minimum */ 348 #define PJSIP_MAX_TSX_COUNT 31 349 #define PJSIP_MAX_DIALOG_COUNT 31 350 #define PJSUA_MAX_CALLS 4 351 352 /* Other pjsua settings */ 353 #define PJSUA_MAX_ACC 4 354 #define PJSUA_MAX_PLAYERS 4 355 #define PJSUA_MAX_RECORDERS 4 356 #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS) 357 #define PJSUA_MAX_BUDDIES 32 358 359 #endif 297 360 298 361 /* -
pjproject/trunk/pjmedia/src/pjmedia-codec/ilbc.c
r2834 r3175 31 31 #include <pj/string.h> 32 32 #include <pj/os.h> 33 #include "../../third_party/ilbc/iLBC_encode.h" 34 #include "../../third_party/ilbc/iLBC_decode.h" 35 33 34 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 35 #include <AudioToolbox/AudioToolbox.h> 36 #define iLBC_Enc_Inst_t AudioConverterRef 37 #define iLBC_Dec_Inst_t AudioConverterRef 38 #define BLOCKL_MAX 1 39 #else 40 #include "../../third_party/ilbc/iLBC_encode.h" 41 #include "../../third_party/ilbc/iLBC_decode.h" 42 #endif 36 43 37 44 /* … … 132 139 pj_timestamp last_tx; 133 140 141 134 142 pj_bool_t enc_ready; 135 143 iLBC_Enc_Inst_t enc; … … 143 151 unsigned dec_samples_per_frame; 144 152 float dec_block[BLOCKL_MAX]; 153 154 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 155 unsigned enc_total_packets; 156 char *enc_buffer; 157 unsigned enc_buffer_offset; 158 159 unsigned dec_total_packets; 160 char *dec_buffer; 161 unsigned dec_buffer_offset; 162 #endif 145 163 }; 146 164 … … 353 371 354 372 ilbc_codec = (struct ilbc_codec*) codec; 373 374 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 375 if (ilbc_codec->enc) { 376 AudioConverterDispose(ilbc_codec->enc); 377 ilbc_codec->enc = NULL; 378 } 379 if (ilbc_codec->dec) { 380 AudioConverterDispose(ilbc_codec->dec); 381 ilbc_codec->dec = NULL; 382 } 383 #endif 384 355 385 pj_pool_release(ilbc_codec->pool); 356 386 … … 380 410 pj_uint16_t dec_fmtp_mode = DEFAULT_MODE, 381 411 enc_fmtp_mode = DEFAULT_MODE; 412 413 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 414 AudioStreamBasicDescription srcFormat, dstFormat; 415 UInt32 size; 416 417 srcFormat.mSampleRate = attr->info.clock_rate; 418 srcFormat.mFormatID = kAudioFormatLinearPCM; 419 srcFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger 420 | kLinearPCMFormatFlagIsPacked; 421 srcFormat.mBitsPerChannel = attr->info.pcm_bits_per_sample; 422 srcFormat.mChannelsPerFrame = attr->info.channel_cnt; 423 srcFormat.mBytesPerFrame = srcFormat.mChannelsPerFrame 424 * srcFormat.mBitsPerChannel >> 3; 425 srcFormat.mFramesPerPacket = 1; 426 srcFormat.mBytesPerPacket = srcFormat.mBytesPerFrame * 427 srcFormat.mFramesPerPacket; 428 429 memset(&dstFormat, 0, sizeof(dstFormat)); 430 dstFormat.mSampleRate = attr->info.clock_rate; 431 dstFormat.mFormatID = kAudioFormatiLBC; 432 dstFormat.mChannelsPerFrame = attr->info.channel_cnt; 433 #endif 382 434 383 435 pj_assert(ilbc_codec != NULL); … … 428 480 429 481 /* Create encoder */ 482 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 483 dstFormat.mFramesPerPacket = CLOCK_RATE * enc_fmtp_mode / 1000; 484 dstFormat.mBytesPerPacket = (enc_fmtp_mode == 20? 38 : 50); 485 486 /* Use AudioFormat API to fill out the rest of the description */ 487 size = sizeof(dstFormat); 488 AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 489 0, NULL, &size, &dstFormat); 490 491 if (AudioConverterNew(&srcFormat, &dstFormat, &ilbc_codec->enc) != noErr) 492 return PJMEDIA_CODEC_EFAILED; 493 ilbc_codec->enc_frame_size = (enc_fmtp_mode == 20? 38 : 50); 494 #else 430 495 ilbc_codec->enc_frame_size = initEncode(&ilbc_codec->enc, enc_fmtp_mode); 496 #endif 431 497 ilbc_codec->enc_samples_per_frame = CLOCK_RATE * enc_fmtp_mode / 1000; 432 498 ilbc_codec->enc_ready = PJ_TRUE; 433 499 434 500 /* Create decoder */ 501 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 502 if (AudioConverterNew(&dstFormat, &srcFormat, &ilbc_codec->dec) != noErr) 503 return PJMEDIA_CODEC_EFAILED; 504 ilbc_codec->dec_samples_per_frame = CLOCK_RATE * dec_fmtp_mode / 1000; 505 #else 435 506 ilbc_codec->dec_samples_per_frame = initDecode(&ilbc_codec->dec, 436 507 dec_fmtp_mode, 437 508 attr->setting.penh); 509 #endif 438 510 ilbc_codec->dec_frame_size = (dec_fmtp_mode == 20? 38 : 50); 439 511 ilbc_codec->dec_ready = PJ_TRUE; … … 511 583 frames[count].size = ilbc_codec->dec_frame_size; 512 584 frames[count].timestamp.u64 = ts->u64 + count * 513 585 ilbc_codec->dec_samples_per_frame; 514 586 515 587 pkt = ((char*)pkt) + ilbc_codec->dec_frame_size; … … 522 594 return PJ_SUCCESS; 523 595 } 596 597 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 598 static OSStatus encodeDataProc ( 599 AudioConverterRef inAudioConverter, 600 UInt32 *ioNumberDataPackets, 601 AudioBufferList *ioData, 602 AudioStreamPacketDescription **outDataPacketDescription, 603 void *inUserData 604 ) 605 { 606 struct ilbc_codec *ilbc_codec = (struct ilbc_codec*)inUserData; 607 608 /* Initialize in case of failure */ 609 ioData->mBuffers[0].mData = NULL; 610 ioData->mBuffers[0].mDataByteSize = 0; 611 612 if (ilbc_codec->enc_total_packets < *ioNumberDataPackets) { 613 *ioNumberDataPackets = ilbc_codec->enc_total_packets; 614 } 615 616 if (*ioNumberDataPackets) { 617 ioData->mBuffers[0].mData = ilbc_codec->enc_buffer + 618 ilbc_codec->enc_buffer_offset; 619 ioData->mBuffers[0].mDataByteSize = *ioNumberDataPackets * 620 ilbc_codec->enc_samples_per_frame 621 << 1; 622 ilbc_codec->enc_buffer_offset += ioData->mBuffers[0].mDataByteSize; 623 } 624 625 ilbc_codec->enc_total_packets -= *ioNumberDataPackets; 626 return noErr; 627 } 628 629 static OSStatus decodeDataProc ( 630 AudioConverterRef inAudioConverter, 631 UInt32 *ioNumberDataPackets, 632 AudioBufferList *ioData, 633 AudioStreamPacketDescription **outDataPacketDescription, 634 void *inUserData 635 ) 636 { 637 struct ilbc_codec *ilbc_codec = (struct ilbc_codec*)inUserData; 638 639 /* Initialize in case of failure */ 640 ioData->mBuffers[0].mData = NULL; 641 ioData->mBuffers[0].mDataByteSize = 0; 642 643 if (ilbc_codec->dec_total_packets < *ioNumberDataPackets) { 644 *ioNumberDataPackets = ilbc_codec->dec_total_packets; 645 } 646 647 if (*ioNumberDataPackets) { 648 ioData->mBuffers[0].mData = ilbc_codec->dec_buffer + 649 ilbc_codec->dec_buffer_offset; 650 ioData->mBuffers[0].mDataByteSize = *ioNumberDataPackets * 651 ilbc_codec->dec_frame_size; 652 ilbc_codec->dec_buffer_offset += ioData->mBuffers[0].mDataByteSize; 653 } 654 655 ilbc_codec->dec_total_packets -= *ioNumberDataPackets; 656 return noErr; 657 } 658 #endif 524 659 525 660 /* … … 534 669 pj_int16_t *pcm_in; 535 670 unsigned nsamples; 671 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 672 UInt32 npackets; 673 OSStatus err; 674 AudioBufferList theABL; 675 #endif 536 676 537 677 pj_assert(ilbc_codec && input && output); … … 574 714 /* Encode */ 575 715 output->size = 0; 716 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 717 npackets = nsamples / ilbc_codec->enc_samples_per_frame; 718 719 theABL.mNumberBuffers = 1; 720 theABL.mBuffers[0].mNumberChannels = 1; 721 theABL.mBuffers[0].mDataByteSize = output_buf_len; 722 theABL.mBuffers[0].mData = output->buf; 723 724 ilbc_codec->enc_total_packets = npackets; 725 ilbc_codec->enc_buffer = (char *)input->buf; 726 ilbc_codec->enc_buffer_offset = 0; 727 728 err = AudioConverterFillComplexBuffer(ilbc_codec->enc, encodeDataProc, 729 ilbc_codec, &npackets, 730 &theABL, NULL); 731 if (err == noErr) { 732 output->size = npackets * ilbc_codec->enc_frame_size; 733 } 734 #else 576 735 while (nsamples >= ilbc_codec->enc_samples_per_frame) { 577 736 unsigned i; … … 589 748 nsamples -= ilbc_codec->enc_samples_per_frame; 590 749 } 750 #endif 591 751 592 752 output->type = PJMEDIA_FRAME_TYPE_AUDIO; … … 605 765 { 606 766 struct ilbc_codec *ilbc_codec = (struct ilbc_codec*)codec; 767 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 768 UInt32 npackets; 769 OSStatus err; 770 AudioBufferList theABL; 771 #else 607 772 unsigned i; 773 #endif 608 774 609 775 pj_assert(ilbc_codec != NULL); … … 617 783 618 784 /* Decode to temporary buffer */ 785 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 786 npackets = input->size / ilbc_codec->dec_frame_size * 787 ilbc_codec->dec_samples_per_frame; 788 789 theABL.mNumberBuffers = 1; 790 theABL.mBuffers[0].mNumberChannels = 1; 791 theABL.mBuffers[0].mDataByteSize = output_buf_len; 792 theABL.mBuffers[0].mData = output->buf; 793 794 ilbc_codec->dec_total_packets = npackets; 795 ilbc_codec->dec_buffer = (char *)input->buf; 796 ilbc_codec->dec_buffer_offset = 0; 797 798 err = AudioConverterFillComplexBuffer(ilbc_codec->dec, decodeDataProc, 799 ilbc_codec, &npackets, 800 &theABL, NULL); 801 if (err == noErr) { 802 output->size = npackets * (ilbc_codec->dec_samples_per_frame << 1); 803 } 804 #else 619 805 iLBC_decode(ilbc_codec->dec_block, (unsigned char*) input->buf, 620 806 &ilbc_codec->dec, 1); … … 625 811 } 626 812 output->size = (ilbc_codec->dec_samples_per_frame << 1); 813 #endif 814 627 815 output->type = PJMEDIA_FRAME_TYPE_AUDIO; 628 816 output->timestamp = input->timestamp; … … 640 828 { 641 829 struct ilbc_codec *ilbc_codec = (struct ilbc_codec*)codec; 830 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 831 UInt32 npackets; 832 OSStatus err; 833 AudioBufferList theABL; 834 #else 642 835 unsigned i; 836 #endif 643 837 644 838 pj_assert(ilbc_codec != NULL); … … 649 843 650 844 /* Decode to temporary buffer */ 845 #ifdef PJMEDIA_ILBC_CODEC_USE_COREAUDIO 846 npackets = 1; 847 848 theABL.mNumberBuffers = 1; 849 theABL.mBuffers[0].mNumberChannels = 1; 850 theABL.mBuffers[0].mDataByteSize = output_buf_len; 851 theABL.mBuffers[0].mData = output->buf; 852 853 ilbc_codec->dec_total_packets = npackets; 854 ilbc_codec->dec_buffer_offset = 0; 855 if (ilbc_codec->dec_buffer) { 856 err = AudioConverterFillComplexBuffer(ilbc_codec->dec, decodeDataProc, 857 ilbc_codec, &npackets, 858 &theABL, NULL); 859 if (err == noErr) { 860 output->size = npackets * 861 (ilbc_codec->dec_samples_per_frame << 1); 862 } 863 } else { 864 output->size = npackets * (ilbc_codec->dec_samples_per_frame << 1); 865 pj_bzero(output->buf, output->size); 866 } 867 #else 651 868 iLBC_decode(ilbc_codec->dec_block, NULL, &ilbc_codec->dec, 0); 652 869 … … 656 873 } 657 874 output->size = (ilbc_codec->dec_samples_per_frame << 1); 875 #endif 658 876 output->type = PJMEDIA_FRAME_TYPE_AUDIO; 659 877 … … 663 881 664 882 #endif /* PJMEDIA_HAS_ILBC_CODEC */ 665 -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r3172 r3175 19 19 */ 20 20 #include <pjsua-lib/pjsua.h> 21 #include "gui.h" 21 22 22 23 … … 150 151 static void ring_stop(pjsua_call_id call_id); 151 152 152 pj_bool_t app_restart; 153 pj_bool_t app_restart; 154 pj_log_func *log_cb = NULL; 153 155 154 156 /***************************************************************************** … … 4495 4497 app_config.cfg.cb.on_mwi_info = &on_mwi_info; 4496 4498 app_config.cfg.cb.on_transport_state = &on_transport_state; 4499 app_config.log_cfg.cb = log_cb; 4497 4500 4498 4501 /* Set sound device latency */ -
pjproject/trunk/pjsip-apps/src/pjsystest/systest.c
r3164 r3175 24 24 unsigned test_item_count; 25 25 test_item_t test_items[SYSTEST_MAX_TEST]; 26 char doc_path[PATH_LENGTH] = {0}; 27 char res_path[PATH_LENGTH] = {0}; 28 char fpath[PATH_LENGTH]; 26 29 27 30 #define USER_ERROR "User used said not okay" … … 83 86 /*****************************************************************/ 84 87 88 PJ_INLINE(char *) add_path(const char *path, const char *fname) 89 { 90 strncpy(fpath, path, PATH_LENGTH); 91 strncat(fpath, fname, PATH_LENGTH); 92 return fpath; 93 } 94 85 95 static void exit_app(void) 86 96 { 87 systest_save_result( RESULT_OUT_PATH);97 systest_save_result(add_path(doc_path, RESULT_OUT_PATH)); 88 98 gui_destroy(); 89 99 } … … 334 344 static void systest_play_wav1(void) 335 345 { 336 const char *paths[] = { WAV_PLAYBACK_PATH,346 const char *paths[] = { add_path(res_path, WAV_PLAYBACK_PATH), 337 347 ALT_PATH1 WAV_PLAYBACK_PATH }; 338 348 systest_play_wav(PJ_ARRAY_SIZE(paths), paths); … … 341 351 static void systest_play_wav2(void) 342 352 { 343 const char *paths[] = { WAV_TOCK8_PATH,353 const char *paths[] = { add_path(res_path, WAV_TOCK8_PATH), 344 354 ALT_PATH1 WAV_TOCK8_PATH}; 345 355 systest_play_wav(PJ_ARRAY_SIZE(paths), paths); … … 352 362 static void systest_rec_audio(void) 353 363 { 354 const pj_str_t filename = pj_str( WAV_REC_OUT_PATH);364 const pj_str_t filename = pj_str(add_path(doc_path, WAV_REC_OUT_PATH)); 355 365 pj_pool_t *pool = NULL; 356 366 enum gui_key key; … … 737 747 static void systest_latency_test(void) 738 748 { 739 const char *ref_wav_paths[] = { WAV_TOCK8_PATH, ALT_PATH1 WAV_TOCK8_PATH };740 const pj_str_t rec_wav_file = pj_str(WAV_LATENCY_OUT_PATH);749 const char *ref_wav_paths[] = { add_path(res_path, WAV_TOCK8_PATH), ALT_PATH1 WAV_TOCK8_PATH }; 750 pj_str_t rec_wav_file; 741 751 pjsua_player_id play_id = PJSUA_INVALID_ID; 742 752 pjsua_conf_port_id play_slot = PJSUA_INVALID_ID; … … 786 796 play_slot = pjsua_player_get_conf_port(play_id); 787 797 798 rec_wav_file = pj_str(add_path(doc_path, WAV_LATENCY_OUT_PATH)); 788 799 status = pjsua_recorder_create(&rec_wav_file, 0, NULL, -1, 0, &rec_id); 789 800 if (status != PJ_SUCCESS) … … 1062 1073 1063 1074 pjsua_logging_config_default(&log_cfg); 1064 log_cfg.log_filename = pj_str( LOG_OUT_PATH);1075 log_cfg.log_filename = pj_str(add_path(doc_path, LOG_OUT_PATH)); 1065 1076 1066 1077 pjsua_config_default(&systest.ua_cfg); -
pjproject/trunk/pjsip-apps/src/pjsystest/systest.h
r3164 r3175 92 92 extern unsigned test_item_count; 93 93 extern test_item_t test_items[SYSTEST_MAX_TEST]; 94 #define PATH_LENGTH 128 95 extern char doc_path[PATH_LENGTH]; 96 extern char res_path[PATH_LENGTH]; 94 97 95 98 test_item_t *systest_alloc_test_item(const char *title);
Note: See TracChangeset
for help on using the changeset viewer.