-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
232 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
TMessagesProj/jni/ffmpeg/build_ffmpeg/vpx-android/_settings.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $ANDROID_NDK ]] || [[ ! -d $ANDROID_NDK ]] ; then | ||
echo "You need to set ANDROID_NDK environment variable, exiting" | ||
echo "Use: export ANDROID_NDK=/your/path/to/android-ndk-rxx" | ||
echo "e.g.: export ANDROID_NDK=/opt/android/android-ndk-r18b" | ||
exit 1 | ||
fi | ||
|
||
set -u | ||
|
||
ANDROID_API=21 | ||
|
||
ABIS=("armeabi-v7a" "arm64-v8a" "x86" "x86_64") | ||
|
||
BASEDIR=`pwd` | ||
NDK=${ANDROID_NDK} | ||
HOST_NUM_CORES=$(nproc) | ||
|
||
CFLAGS_="-DANDROID -fpic -fpie" | ||
LDFLAGS_="" | ||
|
||
configure() { | ||
ABI=$1; | ||
|
||
case $ABI in | ||
armeabi) | ||
NDK_ARCH="arm" | ||
NDK_ABIARCH="arm-linux-androideabi" | ||
CFLAGS="-march=armv5 -marm -finline-limit=64" | ||
LDFLAGS="" | ||
ASFLAGS="" | ||
;; | ||
armeabi-v7a) | ||
NDK_ARCH="arm" | ||
NDK_ABIARCH="arm-linux-androideabi" | ||
CFLAGS="${CFLAGS_} -Os -march=armv7-a -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 -mthumb -D__thumb__" | ||
LDFLAGS="${LDFLAGS_} -march=armv7-a" | ||
ASFLAGS="" | ||
;; | ||
arm64-v8a) | ||
NDK_ARCH="arm64" | ||
NDK_ABIARCH="aarch64-linux-android" | ||
CFLAGS="${CFLAGS_} -O3 -march=armv8-a" | ||
LDFLAGS="${LDFLAGS_}" | ||
ASFLAGS="" | ||
;; | ||
x86) | ||
NDK_ARCH="x86" | ||
NDK_ABIARCH="i686-linux-android" | ||
CFLAGS="${CFLAGS_} -O3 -march=i686 -mtune=intel -msse3 -mfpmath=sse -m32 -fPIC" | ||
LDFLAGS="-m32" | ||
ASFLAGS="-D__ANDROID__" | ||
;; | ||
x86_64) | ||
NDK_ARCH="x86_64" | ||
NDK_ABIARCH="x86_64-linux-android" | ||
CFLAGS="${CFLAGS_} -O3 -march=x86-64 -mtune=intel -msse4.2 -mpopcnt -m64 -fPIC" | ||
LDFLAGS="" | ||
ASFLAGS="-D__ANDROID__" | ||
;; | ||
esac | ||
|
||
TOOLCHAIN_PREFIX=${BASEDIR}/android-toolchain | ||
NDK_SYSROOT=${TOOLCHAIN_PREFIX}/sysroot | ||
|
||
if [[ -e ${TOOLCHAIN_PREFIX} ]]; then | ||
rm -rf ${TOOLCHAIN_PREFIX} | ||
fi | ||
|
||
[[ -d ${TOOLCHAIN_PREFIX} ]] || python ${NDK}/build/tools/make_standalone_toolchain.py \ | ||
--arch ${NDK_ARCH} \ | ||
--api ${ANDROID_API} \ | ||
--stl libc++ \ | ||
--install-dir=${TOOLCHAIN_PREFIX} | ||
|
||
PREFIX=../../../android/${ABI} | ||
|
||
|
||
export PATH=${TOOLCHAIN_PREFIX}/bin:$PATH | ||
export CROSS_PREFIX=${TOOLCHAIN_PREFIX}/bin/${NDK_ABIARCH}- | ||
export CFLAGS="${CFLAGS}" | ||
export CPPFLAGS="${CFLAGS}" | ||
export CXXFLAGS="${CFLAGS} -std=c++11" | ||
export ASFLAGS="${ASFLAGS}" | ||
export LDFLAGS="${LDFLAGS} -L${NDK_SYSROOT}/usr/lib" | ||
|
||
export AR="${CROSS_PREFIX}ar" | ||
export AS="${CROSS_PREFIX}clang" | ||
export CC="${CROSS_PREFIX}clang" | ||
export CXX="${CROSS_PREFIX}clang++" | ||
export LD="${CROSS_PREFIX}ld" | ||
export STRIP="${CROSS_PREFIX}strip" | ||
export RANLIB="${CROSS_PREFIX}ranlib" | ||
export CPP="${CROSS_PREFIX}cpp" | ||
export NM="${CROSS_PREFIX}nm" | ||
|
||
echo "**********************************************" | ||
echo "### Use NDK=${NDK}" | ||
echo "### Use ANDROID_API=${ANDROID_API}" | ||
echo "### Install directory: PREFIX=${PREFIX}" | ||
echo "**********************************************" | ||
} |
84 changes: 84 additions & 0 deletions
84
TMessagesProj/jni/ffmpeg/build_ffmpeg/vpx-android/build-vpx.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
|
||
set -u | ||
. _settings.sh | ||
|
||
LIB_VPX="libvpx" | ||
LIB_GIT=v1.10.0 | ||
|
||
if [[ -f "${LIB_VPX}/build/make/version.sh" ]]; then | ||
version=`"${LIB_VPX}/build/make/version.sh" --bare "${LIB_VPX}"` | ||
fi | ||
|
||
configure_make() { | ||
pushd "${LIB_VPX}" || exit | ||
ABI=$1; | ||
echo -e "\n** BUILD STARTED: ${LIB_VPX} (${version}) for ${ABI} **" | ||
|
||
configure "$@" | ||
case ${ABI} in | ||
armeabi) | ||
TARGET="armv7-android-gcc --disable-neon --disable-neon-asm" | ||
;; | ||
armeabi-v7a) | ||
TARGET="armv7-android-gcc --enable-neon --disable-neon-asm" | ||
;; | ||
arm64-v8a) | ||
TARGET="arm64-android-gcc" | ||
;; | ||
x86) | ||
TARGET="x86-android-gcc" | ||
;; | ||
x86_64) | ||
TARGET="x86_64-android-gcc" | ||
;; | ||
mips) | ||
TARGET="mips32-linux-gcc" | ||
;; | ||
mips64) | ||
TARGET="mips64-linux-gcc" | ||
;; | ||
esac | ||
|
||
make clean | ||
|
||
CPU_DETECT="--disable-runtime-cpu-detect" | ||
if [[ $1 =~ x86.* ]]; then | ||
CPU_DETECT="--enable-runtime-cpu-detect" | ||
fi | ||
|
||
./configure \ | ||
--extra-cflags="-isystem ${NDK_SYSROOT}/usr/include/${NDK_ABIARCH} -isystem ${NDK_SYSROOT}/usr/include" \ | ||
--libc=${NDK_SYSROOT} \ | ||
--prefix=${PREFIX} \ | ||
--target=${TARGET} \ | ||
${CPU_DETECT} \ | ||
--as=auto \ | ||
--disable-docs \ | ||
--enable-pic \ | ||
--enable-libyuv \ | ||
--enable-static \ | ||
--enable-small \ | ||
--enable-optimizations \ | ||
--enable-better-hw-compatibility \ | ||
--enable-realtime-only \ | ||
--enable-vp8 \ | ||
--enable-vp9 \ | ||
--disable-webm-io \ | ||
--disable-examples \ | ||
--disable-tools \ | ||
--disable-debug \ | ||
--disable-unit-tests || exit 1 | ||
|
||
make -j${HOST_NUM_CORES} install | ||
popd || true | ||
} | ||
|
||
for ((i=0; i < ${#ABIS[@]}; i++)) | ||
do | ||
if [[ $# -eq 0 ]] || [[ "$1" == "${ABIS[i]}" ]]; then | ||
[[ ${ANDROID_API} -lt 21 ]] && ( echo "${ABIS[i]}" | grep 64 > /dev/null ) && continue; | ||
configure_make "${ABIS[i]}" | ||
echo -e "** BUILD COMPLETED: ${LIB_VPX} for ${ABIS[i]} **\n\n" | ||
fi | ||
done |
a1817ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ever since the ffmpeg update the app causes a lot of heating and battery drain, reverting to a build with old ffmpeg everything gets fixed
Can you guys look into it?
a1817ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xaxtix
Telegram-FOSS updated ffmpeg last year, had the same issue
apply this patch
Telegram-FOSS-Team/Telegram-FOSS@86a6555
:)
a1817ea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you even though I'm not being referenced here, looks like it's about time I get api keys and do a custom build or switch to telegram foss for now. Appreciate the help :)