Skip to content

Commit ffb9b26

Browse files
Merge pull request #10 from weslleymurdock/add-bcg729
Add bcg729
2 parents 4415e8a + a75aa8c commit ffb9b26

File tree

5 files changed

+77
-9
lines changed

5 files changed

+77
-9
lines changed

.github/workflows/pjsua2.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
brew install nasm autoconf automake libtool swig
3030
sudo mv /Applications/Xcode_15.1.app /Applications/Xcode.app
3131
sed -i'' -e 's/xamarin/maui/g' ${{ github.workspace }}/pjproject/pjsip-apps/src/swig/csharp/Makefile
32-
./build --ssl --opus --h264 -a=x86_64,arm64 --ci
32+
./build h264 opus ssl bcg729 -a=x86_64,arm64 --ci
3333
- uses: actions/upload-artifact@v3
3434
with:
3535
name: libpjsua2-ios

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
brew install nasm autoconf automake libtool swig
2727
sed -i'' -e 's/xamarin/maui/g' ${{ github.workspace }}/pjproject/pjsip-apps/src/swig/csharp/Makefile
28-
./build h264 opus ssl -a=x86_64,arm64 --ci
28+
./build h264 opus ssl bcg729 -a=x86_64,arm64 --ci
2929
tar -zcvf libpjsua2.tar.gz ./libpjsua2
3030
- name: release
3131
uses: actions/create-release@v1

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@
1313
[submodule "external/opus"]
1414
path = external/opus
1515
url = https://github.com/xiph/opus/
16+
[submodule "external/bcg729"]
17+
path = external/bcg729
18+
url = https://github.com/BelledonneCommunications/bcg729

build

+71-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export CLEAN_PJSIP_SRC=true
2222
export SSL_SUPPORT=false
2323
export OPUS_SUPPORT=false
2424
export H264_SUPPORT=false
25+
export BCG729_SUPPORT=false
2526
export INDEPENDENT_WEBRTC=false
2627
export ENABLE_ZRTP=false
2728
export HAS_BITCODE=true
@@ -48,7 +49,7 @@ export SSL_BUILD_DIR="$BUILD_DIR/openssl_ios"
4849
export ZRTP_BUILD_DIR="$BUILD_DIR/zrtp"
4950
export OPUS_BUILD_DIR="$BUILD_DIR/opus"
5051
export H264_BUILD_DIR="$BUILD_DIR/openh264"
51-
52+
export BCG729_BUILD_DIR="$BUILD_DIR/bcg729"
5253
export XCODE_SIMULATOR_DEV_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer"
5354
export XCODE_DEVICE_DEV_PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"
5455

@@ -95,6 +96,10 @@ for i in "$@"; do
9596
OPUS_SUPPORT=true
9697
shift
9798
;;
99+
-bcg729 | --bcg729 | bcg729)
100+
BCG729_SUPPORT=true
101+
shift
102+
;;
98103
-h264 | --h264 | h264)
99104
H264_SUPPORT=true
100105
shift
@@ -120,7 +125,7 @@ for i in "$@"; do
120125
shift
121126
;;
122127
-v | --version | version)
123-
echo "PJSIP Compile script version: 1.0.0"
128+
echo "PJSIP Compile script version: 2.0.0"
124129
exit 1
125130
shift
126131
;;
@@ -142,6 +147,8 @@ function show_help () {
142147
echo
143148
echo " -ssl, --ssl, ssl Include SSL for encrypted calling. (default: not build)"
144149
echo
150+
echo " -bcg729, --bcg729, bcg729 Include BCG729 codecs. (default: not build)"
151+
echo
145152
echo " -opus, --opus, opus Support for the OPUS codec. (default: not build)"
146153
echo
147154
echo " --no-download-pjsip-src Don't download a new PJSIP source"
@@ -186,6 +193,38 @@ function spinner() {
186193
printf " \b\b\b\b"
187194
}
188195

196+
197+
function build_bcg729 () {
198+
if [ $BCG729_SUPPORT = false ]; then
199+
return
200+
fi
201+
echo "Use BCG729"
202+
xcode_dev_path=`xcode-select -print-path`
203+
204+
cd $BCG729_BUILD_DIR
205+
206+
for arch in ${USE_ARCHS[@]}
207+
do
208+
echo "-- BCG729: Compiling $arch"
209+
if [ "$arch" == "x86_64" ]; then
210+
os_platform="iPhoneSimulator"
211+
mkdir -p "${os_platform}${IOS_SDK_VERSION}-${arch}.sdk"
212+
cmake . -DCMAKE_INSTALL_PREFIX="${os_platform}${IOS_SDK_VERSION}-${arch}.sdk" -DCMAKE_SKIP_INSTALL_RPATH=ON
213+
make C_FLAGS="$C_FLAGS -O2 -m64 -mios-simulator-version-min=${MIN_IOS_VERSION} -isysroot ${xcode_dev_path}/Platforms/${os_platform}.platform/Developer/SDKs/${os_platform}.sdk -march=x86-64" || exit
214+
215+
else
216+
os_platform="iPhoneOS"
217+
mkdir -p "${os_platform}${IOS_SDK_VERSION}-${arch}.sdk"
218+
cmake . -DCMAKE_INSTALL_PREFIX="${os_platform}${IOS_SDK_VERSION}-${arch}.sdk" -DCMAKE_SKIP_INSTALL_RPATH=ON
219+
make C_FLAGS="$C_FLAGS -miphoneos-version-min=${MIN_IOS_VERSION} -isysroot ${xcode_dev_path}/Platforms/${os_platform}.platform/Developer/SDKs/${os_platform}.sdk -march=${arch}" || exit
220+
fi
221+
make install
222+
done
223+
lipo -info "$BCG729_BUILD_DIR/iPhoneSimulator17.2-x86_64.sdk/lib/libbcg729.a"
224+
lipo -info "$BCG729_BUILD_DIR/iPhoneOS17.2-arm64.sdk/lib/libbcg729.a"
225+
226+
}
227+
189228
function build_h264 () {
190229
if [ $H264_SUPPORT = false ]; then
191230
return
@@ -275,7 +314,7 @@ function build_opus () {
275314
return
276315
fi
277316

278-
opus_version="1.3.1"
317+
opus_version="1.4"
279318
opus_opt_cflags="-Ofast -flto -g"
280319
opus_opt_ldflags="-flto"
281320
opus_opt_config_args=""
@@ -402,6 +441,10 @@ function config_site () {
402441
echo "#define PJMEDIA_HAS_OPUS_CODEC 1" >> "$PJSIP_CONFIG_SITE_H"
403442
fi
404443

444+
if [ $BCG729_SUPPORT = true ]; then
445+
echo "#define PJMEDIA_HAS_BCG729 1" >> "$PJSIP_CONFIG_SITE_H"
446+
fi
447+
405448
while IFS=',' read -ra CONFIG_SITE_OPTION; do
406449
for i in "${CONFIG_SITE_OPTION[@]}"; do
407450
echo "#define $i" >> $PJSIP_CONFIG_SITE_H
@@ -479,6 +522,17 @@ function _build () {
479522
export CFLAGS="${CFLAGS} -fembed-bitcode"
480523
fi
481524

525+
if [ $BCG729_SUPPORT = true ]; then
526+
if [ "$arch" != "i386" ] && [ "$arch" != "x86_64" ]; then
527+
configure="$configure --with-bcg729=${BCG729_BUILD_DIR}/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk"
528+
export CFLAGS="${CFLAGS} -I${BCG729_BUILD_DIR}/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk/include/bcg729"
529+
export LDFLAGS="${LDFLAGS} -L${BCG729_BUILD_DIR}/iPhoneOS${IOS_SDK_VERSION}-${arch}.sdk/lib"
530+
else
531+
configure="$configure --with-bcg729=${BCG729_BUILD_DIR}/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk"
532+
export CFLAGS="${CFLAGS} -I${BCG729_BUILD_DIR}/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk/include/bcg729"
533+
export LDFLAGS="${LDFLAGS} -L${BCG729_BUILD_DIR}/iPhoneSimulator${IOS_SDK_VERSION}-${arch}.sdk/lib"
534+
fi
535+
fi
482536

483537
if [ $SSL_SUPPORT = true ]; then
484538
if [ "$arch" != "i386" ] && [ "$arch" != "x86_64" ]; then
@@ -520,9 +574,11 @@ function _build () {
520574

521575
ARCH="-arch $arch " $configure #>> $arch_log 2>&1 || exit
522576
echo "make dep"
523-
make dep >> $arch_log 2>&1 || exit
577+
make dep >> $arch_log 2>&1 &
578+
spinner $! || exit
524579
echo "make "
525-
make >> $arch_log 2>&1 || exit
580+
make >> $arch_log 2>&1 &
581+
spinner $! || exit
526582

527583
if [ $SSL_SUPPORT = true ]; then
528584
if [ $ENABLE_ZRTP = true ]; then
@@ -539,8 +595,12 @@ function _build () {
539595
#TODO: fix libs not found on runner path because they are in temp
540596
echo "Making swig "
541597
cd "$PJSIP_SRC_DIR/pjsip-apps/src/swig"
542-
make clean
543-
make
598+
make clean >> $arch_log 2>&1 &
599+
spinner $! || exit
600+
601+
make >> $arch_log 2>&1 &
602+
spinner $! || exit
603+
544604

545605
echo "Done building for $arch"
546606
echo "============================="
@@ -570,6 +630,9 @@ function _collect () {
570630
cp -v ./external/openssl_ios/bin/*$1.sdk/lib/*.a $BASE_DIR/lib/$1
571631
fi
572632

633+
if [ -d ./external/bcg729/*$1.sdk/lib/ ]; then
634+
cp -v ./external/bcg729/*$1.sdk/lib/*.a $BASE_DIR/lib/$1
635+
fi
573636
# if [ $INDEPENDENT_WEBRTC = true ]; then
574637
# rm ./pjproject/third_party/lib/libsrtp*.a
575638
# fi
@@ -731,6 +794,7 @@ fi
731794
if [ $SHOW_HELP = true ]; then
732795
show_help
733796
else
797+
build_bcg729
734798
build_h264
735799
build_ssl
736800
build_opus

external/bcg729

Submodule bcg729 added at e29952e

0 commit comments

Comments
 (0)