Build PJSIP with openh264
Publish date: Mar 22, 2019
Step 1. Download openh264
- Unzip file and move to /User/me
- Create new folder: android in openh264 folder
- Modified OpenH264’s Makefile by setting PREFIX=android
- And
make OS=android NDKROOT=<path-to-ndk> TARGET=android-19 APP_ABI=armeabi ARCH=arm make OS=android NDKROOT=<path-to-ndk> TARGET=android-19 APP_ABI=armeabi ARCH=arm clean make install OS=android NDKROOT=<path-to-ndk> TARGET=android-19 APP_ABI=armeabi ARCH=arm
Step 2. Create config_site.h
- Download pjsip from repository
- Create config_site.h
- Go to /path/to/your/pjsip/dir/pjlib/include/pj
- Copy config_site_sample.h
- Rename copy file to config_site.h
- Add:
#define PJ_CONFIG_ANDROID 1 #include <pj/config_site_sample.h> #define PJMEDIA_HAS_VIDEO 1 #define PJMEDIA_HAS_OPENH264_CODEC 1
Step 3. Build Preparation
cd /path/to/your/pjsip/dir
export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
APP_PLATFORM=android-19 ./configure-android --with-openh264=<path-to-openh264>/android
make dep && make clean && make
Note: This will build armeabi target, to build for other targets:
TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
Step 4. Video Support
Copy all library .so files into your Android application project directory, for example:
cp /Users/me/openh264/android/*.so /Users/me/pjproject-2.0/pjsip-apps/src/swig/java/android/libs/armeabi
Step 5. Build libpjsua2.so and running sample application
cd /path/to/your/pjsip/dir
cd pjsip-apps/src/swig
make clean && make
This step should produce:
- native library libpjsua2.so in pjsip-apps/src/swig/java/android/app/src/main/jniLibs/armeabi
- Open pjsua2 app project in Android Studio, it is located in pjsip-apps/src/swig/java/android
Step 6. Run it
Disqus comments are disabled.