Search code examples
pjsippjsua2

How to build g729 for pjsipandroid


I am trying to build g729 codec for pjsip android.
PJSIP Build link for G729Android

I followed the link and i am able to build g729project. After succesfully build,it produces three directories named include, shared and lib. so when trying to build android pjsip project with the g729codec build path,pjsip is not able to recogonize the g729build directories.

PJSIP says follow the android build instructions for g729 as specifed by belladone.But i couldnt find any. so how to fix it??


Solution

  • In Belldone Communications there is no clear explanation of how to build the G729 project using CMake for each Target platforms.

    step 1: CMAKE Download Link=> https://cmake.org/download/

    Just download Cmake software using above link for your platform(Linux/Mac/Windows OS).

    For Linux, download cmake tar file and extract into desired path. Go to [Cmake Path]/bin/ path. Right click on cmake-gui Application and run it.

    step 2: Download G729 project of Belldone communications.

    i) select your downloaded g729 project folder as source code path.

    ii) create empty folder for cmake binaries and select it for build the binaries. It will make the makefiles for building your project for your specified platform.

    Note: Install Android-ndk-r15c for Latest PJSIP 2.7

    iii) Specify following name and value in CMAKE

    CMAKE_C_FLAGS is important one. Use same CFLAG what you are using for building PJSIP 2.7.

    CMAKE_C_FLAGS = -gcc-toolchain /home/application/Desktop/pjsip2_7/NDK/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 -fpic -ffunction-sections -funwind-tables -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes -fno-integrated-as -target armv7-none-linux-androideabi26 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -DNDEBUG -Ijni -DANDROID -D__ANDROID_API__=26 -Wa,--noexecstack -Wformat -Werror=format-security --sysroot /home/application/Desktop/pjsip2_7/NDK/android-ndk-r15c/platforms/android-26/arch-arm/ -isystem /home/application/Desktop/pjsip2_7/NDK/android-ndk-r15c/sysroot/usr/include/arm-linux-androideabi -I/home/application/Desktop/pjsip2_7/NDK/android-ndk-r15c//sources/cxx-stl/llvm-libc++/include

    NOTE: compare your --sysroot path is same as above one.

    CMAKE_AR, CMAKE_LINKER, CMAKE_NM, CMAKE_OBJCOPY, CMAKE_OBJDUMP, CMAKE_RANLIB, CMAKE_STRIP which are available in following android ndk path

    /android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/

    CMAKE_C_COMPILER = /android-ndk-r15c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang/

    CMAKE_INSTALL_PREFIX= where you want to create output library files which is later used for building pjsip. Use the same path while building PJSIP --with-bcg729 = CMAKE_INSTALL_PREFIX path.

    CMAKE_SKIP_INSTALL_RPATH = ON

    ENABLE_SHARED = ON

    ENABLE_STATIC = ON

    ENABLE_TESTS = ON

    CMAKE_BUILD_TYPE = Release

    After specify the above Configuration, you can Configure and Generate the Cmake outputs.

    Then Go to Binaries path using terminal which is specified in your Cmake App.Run the following command.

    make && make install
    

    Finally the library files are created on CMAKE_INSTALL_PREFIX path.

    Build PJSIP library using that path like below,

    TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags --with-bcg729=/home/Desktop/g729_libraries/
    

    while building if it shows as,

    Using bcg729 prefix... /home/Desktop/g729_libraries/
    checking bcg729 usablitiy... ok
    

    then you successfully integrated bcg729 into PJSIP 2.7

    If it not results like above, please comment below!