diff --git a/.gitignore b/.gitignore index 91ebc0a8..240eae42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ pjproject-2.4.5 openssl-1.0.2d -openh264-1.4.0 +openh264-1.0.0 android-ndk-r10e android-sdk-linux pjsip-build diff --git a/build b/build index e087bfc3..ab2de8c3 100755 --- a/build +++ b/build @@ -40,6 +40,7 @@ do cd "${PJSIP_TMP_PATH}" TARGET_ABI=$arch ./configure-android --use-ndk-cflags \ --with-ssl="${OPENSSL_BUILD_OUT_PATH}/libs/${arch}" \ + --with-openh264="${OPENH264_BUILD_OUT_PATH}/libs/${arch}" \ >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1 make dep >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1 make >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1 @@ -48,9 +49,14 @@ do cd "${PJSUA_BASE_DIR}" make >>"${FINAL_BUILD_LOGS}/${arch}.log" 2>&1 - echo "Copying .so library to final build directory ..." + echo "Copying PJSUA .so library to final build directory ..." mkdir -p "${FINAL_BUILD_LIB}/${arch}" mv "${PJSUA_GENERATED_SO_PATH}" "${FINAL_BUILD_LIB}/${arch}/" + + if [ -f ${OPENH264_BUILD_OUT_PATH}/libs/${arch}/lib/libopenh264.so ]; then + echo "Copying OpenH264 .so library to final build directory ..." + cp ${OPENH264_BUILD_OUT_PATH}/libs/${arch}/lib/libopenh264.so ${FINAL_BUILD_LIB}/${arch}/ + fi done echo "Copying PJSUA2 java bindings to final build directory ..." diff --git a/config.conf b/config.conf index 20862fb1..bb32264a 100644 --- a/config.conf +++ b/config.conf @@ -36,11 +36,11 @@ OPENSSL_DIR_NAME="openssl-1.0.2d" OPENSSL_BUILD_OUT_PATH=$(pwd)"/openssl-build-output" #The URL from which to download OpenH264 sources tag -OPENH264_DOWNLOAD_URL="https://github.com/cisco/openh264/archive/v1.4.0.tar.gz" +OPENH264_DOWNLOAD_URL="https://github.com/cisco/openh264/archive/v1.0.0.tar.gz" #The name of the folder generated when untarring OpenH264 sources file #In general, the name corresponds to that of the tar, except the file extension -OPENH264_DIR_NAME="openh264-1.4.0" +OPENH264_DIR_NAME="openh264-1.0.0" #The output directory where to store OpenH264 compiled libraries OPENH264_BUILD_OUT_PATH=$(pwd)"/openh264-build-output" diff --git a/openh264-1.0.0-android21.patch b/openh264-1.0.0-android21.patch new file mode 100644 index 00000000..57ff91a3 --- /dev/null +++ b/openh264-1.0.0-android21.patch @@ -0,0 +1,118 @@ +diff --git a/README.md b/README.md +index 6404d7dd92934cecd6e48f15adf4b90c205d9284..6e441576789ffe457bd1938052d65271459e492f 100644 +--- a/README.md ++++ b/README.md +@@ -67,11 +67,10 @@ Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as andr + You can also set ARCH, NDKLEVEL, GCCVERSION according to your device and NDK version. + ARCH specifies the architecture of android device. Currently only arm and x86 are supported, the default is arm. + NDKLEVEL specifies android api level, the api level can be 12-19, the default is 12. +-GCCVERSION specifies which gcc in NDK is used, the default is 4.8. + + By default these commands build for the armeabi-v7a ABI. To build for the other android +-ABIs, add "ARCH=mips" or "ARCH=x86". To build for the older armeabi ABI (which has +-armv5te as baseline), add "APP_ABI=armeabi" (ARCH=arm is implicit). ++ABIs, add "ARCH=arm64", "ARCH=x86", "ARCH=x86_64", "ARCH=mips" or "ARCH=mips64". ++To build for the older armeabi ABI (which has armv5te as baseline), add "APP_ABI=armeabi" (ARCH=arm is implicit). + + For iOS Builds + -------------- +diff --git a/build/platform-android.mk b/build/platform-android.mk +index 5ae754a0b0ba7d102f7791d9d28dabe42eb6e7a0..3d76cb1a57ad7cc428ca5e6ccd2d901c09bd5946 100644 +--- a/build/platform-android.mk ++++ b/build/platform-android.mk +@@ -12,13 +12,20 @@ ifeq ($(ARCH), arm) + ifeq (Yes, $(USE_ASM)) + ASMFLAGS += -march=armv7-a -mfpu=neon + endif ++else ifeq ($(ARCH), arm64) ++ APP_ABI = arm64-v8a + else ifeq ($(ARCH), x86) +- APP_ABI = x86 ++ APP_ABI = x86 + ifeq (Yes, $(USE_ASM)) + ASMFLAGS += -f elf32 + endif ++else ifeq ($(ARCH), x86_64) ++ APP_ABI = x86_64 ++ ifeq (Yes, $(USE_ASM)) ++ ASMFLAGS += -f elf64 ++ endif + else +- APP_ABI = $(ARCH) ++ APP_ABI = $(ARCH) + endif + + ifndef NDKROOT +diff --git a/codec/common/inc/crt_util_safe_x.h b/codec/common/inc/crt_util_safe_x.h +index 4d0d18715f139b3eca0a0b0ca43cb24a2582f030..f607c136ff411b1c8b44a487efa0bba322b6fbef 100644 +--- a/codec/common/inc/crt_util_safe_x.h ++++ b/codec/common/inc/crt_util_safe_x.h +@@ -52,7 +52,6 @@ + #include + #include + #else +-#include + #include + #include "typedefs.h" + #endif//_WIN32 +@@ -72,7 +71,10 @@ typedef FILE WelsFileHandle; + #ifdef _WIN32 + typedef struct _timeb SWelsTime; + #else +-typedef struct timeb SWelsTime; ++typedef struct TagWelsTime { ++ time_t time; ++ unsigned short millitm; ++} SWelsTime; + #endif + + int32_t WelsSnprintf (char* buffer, int32_t sizeOfBuffer, const char* format, ...); +diff --git a/codec/common/inc/measure_time.h b/codec/common/inc/measure_time.h +index 86b820a2d04e77702fefd473872acc9038567c5e..c1baa041a94df5808113a8c48caa443b5c187d56 100644 +--- a/codec/common/inc/measure_time.h ++++ b/codec/common/inc/measure_time.h +@@ -47,7 +47,6 @@ + #include + #else + #include +-#include + #endif + #include + +diff --git a/codec/common/src/crt_util_safe_x.cpp b/codec/common/src/crt_util_safe_x.cpp +index 4967840a1d4990882395526213c3053c1b3ada55..a6dea9cde774ddc7bc9b033c0d3cbaf46ba46687 100644 +--- a/codec/common/src/crt_util_safe_x.cpp ++++ b/codec/common/src/crt_util_safe_x.cpp +@@ -51,7 +51,6 @@ + #endif //!_MSC_VER + #else + #include +-#include + #endif //_WIN32 + + #include "macros.h" +diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp +index 9ebf9c1d695679e53ff01ff75dbccad8e2e417e3..cf78638a66e3e0f881f27b3949f26bd1891450ac 100644 +--- a/codec/decoder/plus/src/welsDecoderExt.cpp ++++ b/codec/decoder/plus/src/welsDecoderExt.cpp +@@ -65,7 +65,6 @@ extern "C" { + #include + #include + #include +-#include + #else + #include + #endif +diff --git a/codec/encoder/plus/src/welsEncoderExt.cpp b/codec/encoder/plus/src/welsEncoderExt.cpp +index 26c97af417e27cdbee55e1fa4e7e88a34e5d3393..2278c1ce2d9257eb4c0dec0f66bf7a7ce85893e9 100644 +--- a/codec/encoder/plus/src/welsEncoderExt.cpp ++++ b/codec/encoder/plus/src/welsEncoderExt.cpp +@@ -48,7 +48,6 @@ + #include + #include + #include +-#include + #else + #include + #endif + diff --git a/prepare-build-system b/prepare-build-system index 4a4a91b2..0066a491 100755 --- a/prepare-build-system +++ b/prepare-build-system @@ -80,7 +80,8 @@ then curl -L -o openssl.tar.gz "$OPENSSL_DOWNLOAD_URL" rm -rf "$OPENSSL_DIR_NAME" tar xzvf openssl.tar.gz && rm -rf openssl.tar.gz - ${BASEDIR}/openssl-build-target-archs + cd ${BASEDIR} + ./openssl-build-target-archs fi if [ "$DOWNLOAD_OPENH264" == "1" ] @@ -89,7 +90,14 @@ then curl -L -o openh264.tar.gz "$OPENH264_DOWNLOAD_URL" rm -rf "${OPENH264_DIR_NAME}" tar xzvf openh264.tar.gz && rm -rf openh264.tar.gz - ${BASEDIR}/openh264-build-target-archs + if [ "${OPENH264_DIR_NAME}" == "openh264-1.0.0" ] + then + echo "Patching OpenH264 to be able to compile with Android API 21+.." + cp ${BASEDIR}/openh264-1.0.0-android21.patch ${BASEDIR}/${OPENH264_DIR_NAME}/ + cd ${OPENH264_DIR_NAME} && patch -p1 < openh264-1.0.0-android21.patch || true + fi + cd ${BASEDIR} + ./openh264-build-target-archs fi echo "The build system is ready! Execute: ./build to build PJSIP :)"