mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Update audio extension build configurations
- Fix FLAC extension build (currently broken due to use of std::array, but fixed by migrating to NDK r20). - Move opus and ffmpeg extensions to NDK r20. For ffmpeg, upgrade to release 4.2 which requires using libswresample and updates to the build script. Issue: #6601 PiperOrigin-RevId: 277924119
This commit is contained in:
parent
2106e5f328
commit
a4e7274cca
10 changed files with 36 additions and 20 deletions
|
|
@ -107,6 +107,12 @@
|
||||||
* Fix the start of audio getting truncated when transitioning to a new
|
* Fix the start of audio getting truncated when transitioning to a new
|
||||||
item in a playlist of opus streams.
|
item in a playlist of opus streams.
|
||||||
* Fix detection of Dolby Atmos in HLS to match the HLS authoring specification.
|
* Fix detection of Dolby Atmos in HLS to match the HLS authoring specification.
|
||||||
|
* Fix FLAC extension build
|
||||||
|
([#6601](https://github.com/google/ExoPlayer/issues/6601).
|
||||||
|
* Update the ffmpeg, flac and opus extension build instructions to use NDK r20.
|
||||||
|
* Update the ffmpeg extension to release 4.2. It is necessary to rebuild the
|
||||||
|
native part of the extension after this change, following the instructions in
|
||||||
|
the extension's readme.
|
||||||
|
|
||||||
### 2.10.6 (2019-10-17) ###
|
### 2.10.6 (2019-10-17) ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ FFMPEG_EXT_PATH="$(pwd)/extensions/ffmpeg/src/main/jni"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Download the [Android NDK][] and set its location in a shell variable.
|
* Download the [Android NDK][] and set its location in a shell variable.
|
||||||
Only versions up to NDK 15c are supported currently.
|
This build configuration has been tested on NDK r20.
|
||||||
|
|
||||||
```
|
```
|
||||||
NDK_PATH="<path to Android NDK>"
|
NDK_PATH="<path to Android NDK>"
|
||||||
|
|
@ -50,7 +50,7 @@ ENABLED_DECODERS=(vorbis opus flac)
|
||||||
```
|
```
|
||||||
|
|
||||||
* Fetch and build FFmpeg. For example, executing script `build_ffmpeg.sh` will
|
* Fetch and build FFmpeg. For example, executing script `build_ffmpeg.sh` will
|
||||||
fetch and build FFmpeg release 4.0 for armeabi-v7a, arm64-v8a and x86:
|
fetch and build FFmpeg release 4.2 for armeabi-v7a, arm64-v8a and x86:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd "${FFMPEG_EXT_PATH}" && \
|
cd "${FFMPEG_EXT_PATH}" && \
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public final class FfmpegLibrary {
|
||||||
private static final String TAG = "FfmpegLibrary";
|
private static final String TAG = "FfmpegLibrary";
|
||||||
|
|
||||||
private static final LibraryLoader LOADER =
|
private static final LibraryLoader LOADER =
|
||||||
new LibraryLoader("avutil", "avresample", "avcodec", "ffmpeg");
|
new LibraryLoader("avutil", "avresample", "swresample", "avcodec", "ffmpeg");
|
||||||
|
|
||||||
private FfmpegLibrary() {}
|
private FfmpegLibrary() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,17 @@ LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
||||||
include $(PREBUILT_SHARED_LIBRARY)
|
include $(PREBUILT_SHARED_LIBRARY)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := libavutil
|
LOCAL_MODULE := libavresample
|
||||||
LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
||||||
include $(PREBUILT_SHARED_LIBRARY)
|
include $(PREBUILT_SHARED_LIBRARY)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := libavresample
|
LOCAL_MODULE := libswresample
|
||||||
|
LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
||||||
|
include $(PREBUILT_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
LOCAL_MODULE := libavutil
|
||||||
LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
LOCAL_SRC_FILES := ffmpeg/android-libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE).so
|
||||||
include $(PREBUILT_SHARED_LIBRARY)
|
include $(PREBUILT_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
|
@ -35,6 +40,6 @@ include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := ffmpeg
|
LOCAL_MODULE := ffmpeg
|
||||||
LOCAL_SRC_FILES := ffmpeg_jni.cc
|
LOCAL_SRC_FILES := ffmpeg_jni.cc
|
||||||
LOCAL_C_INCLUDES := ffmpeg
|
LOCAL_C_INCLUDES := ffmpeg
|
||||||
LOCAL_SHARED_LIBRARIES := libavcodec libavresample libavutil
|
LOCAL_SHARED_LIBRARIES := libavcodec libavresample libswresample libavutil
|
||||||
LOCAL_LDLIBS := -Lffmpeg/android-libs/$(TARGET_ARCH_ABI) -llog
|
LOCAL_LDLIBS := -Lffmpeg/android-libs/$(TARGET_ARCH_ABI) -llog
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
APP_OPTIM := release
|
APP_OPTIM := release
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
APP_CPPFLAGS := -frtti
|
APP_CPPFLAGS := -frtti
|
||||||
APP_PLATFORM := android-9
|
APP_PLATFORM := android-9
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,10 @@ COMMON_OPTIONS="
|
||||||
--disable-postproc
|
--disable-postproc
|
||||||
--disable-avfilter
|
--disable-avfilter
|
||||||
--disable-symver
|
--disable-symver
|
||||||
--disable-swresample
|
|
||||||
--enable-avresample
|
--enable-avresample
|
||||||
|
--enable-swresample
|
||||||
"
|
"
|
||||||
|
TOOLCHAIN_PREFIX="${NDK_PATH}/toolchains/llvm/prebuilt/${HOST_PLATFORM}/bin"
|
||||||
for decoder in "${ENABLED_DECODERS[@]}"
|
for decoder in "${ENABLED_DECODERS[@]}"
|
||||||
do
|
do
|
||||||
COMMON_OPTIONS="${COMMON_OPTIONS} --enable-decoder=${decoder}"
|
COMMON_OPTIONS="${COMMON_OPTIONS} --enable-decoder=${decoder}"
|
||||||
|
|
@ -42,13 +43,14 @@ done
|
||||||
cd "${FFMPEG_EXT_PATH}"
|
cd "${FFMPEG_EXT_PATH}"
|
||||||
(git -C ffmpeg pull || git clone git://source.ffmpeg.org/ffmpeg ffmpeg)
|
(git -C ffmpeg pull || git clone git://source.ffmpeg.org/ffmpeg ffmpeg)
|
||||||
cd ffmpeg
|
cd ffmpeg
|
||||||
git checkout release/4.0
|
git checkout release/4.2
|
||||||
./configure \
|
./configure \
|
||||||
--libdir=android-libs/armeabi-v7a \
|
--libdir=android-libs/armeabi-v7a \
|
||||||
--arch=arm \
|
--arch=arm \
|
||||||
--cpu=armv7-a \
|
--cpu=armv7-a \
|
||||||
--cross-prefix="${NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/${HOST_PLATFORM}/bin/arm-linux-androideabi-" \
|
--cross-prefix="${TOOLCHAIN_PREFIX}/armv7a-linux-androideabi16-" \
|
||||||
--sysroot="${NDK_PATH}/platforms/android-9/arch-arm/" \
|
--nm="${TOOLCHAIN_PREFIX}/arm-linux-androideabi-nm" \
|
||||||
|
--strip="${TOOLCHAIN_PREFIX}/arm-linux-androideabi-strip" \
|
||||||
--extra-cflags="-march=armv7-a -mfloat-abi=softfp" \
|
--extra-cflags="-march=armv7-a -mfloat-abi=softfp" \
|
||||||
--extra-ldflags="-Wl,--fix-cortex-a8" \
|
--extra-ldflags="-Wl,--fix-cortex-a8" \
|
||||||
--extra-ldexeflags=-pie \
|
--extra-ldexeflags=-pie \
|
||||||
|
|
@ -60,8 +62,9 @@ make clean
|
||||||
--libdir=android-libs/arm64-v8a \
|
--libdir=android-libs/arm64-v8a \
|
||||||
--arch=aarch64 \
|
--arch=aarch64 \
|
||||||
--cpu=armv8-a \
|
--cpu=armv8-a \
|
||||||
--cross-prefix="${NDK_PATH}/toolchains/aarch64-linux-android-4.9/prebuilt/${HOST_PLATFORM}/bin/aarch64-linux-android-" \
|
--cross-prefix="${TOOLCHAIN_PREFIX}/aarch64-linux-android21-" \
|
||||||
--sysroot="${NDK_PATH}/platforms/android-21/arch-arm64/" \
|
--nm="${TOOLCHAIN_PREFIX}/aarch64-linux-android-nm" \
|
||||||
|
--strip="${TOOLCHAIN_PREFIX}/aarch64-linux-android-strip" \
|
||||||
--extra-ldexeflags=-pie \
|
--extra-ldexeflags=-pie \
|
||||||
${COMMON_OPTIONS}
|
${COMMON_OPTIONS}
|
||||||
make -j4
|
make -j4
|
||||||
|
|
@ -71,8 +74,9 @@ make clean
|
||||||
--libdir=android-libs/x86 \
|
--libdir=android-libs/x86 \
|
||||||
--arch=x86 \
|
--arch=x86 \
|
||||||
--cpu=i686 \
|
--cpu=i686 \
|
||||||
--cross-prefix="${NDK_PATH}/toolchains/x86-4.9/prebuilt/${HOST_PLATFORM}/bin/i686-linux-android-" \
|
--cross-prefix="${TOOLCHAIN_PREFIX}/i686-linux-android16-" \
|
||||||
--sysroot="${NDK_PATH}/platforms/android-9/arch-x86/" \
|
--nm="${TOOLCHAIN_PREFIX}/i686-linux-android-nm" \
|
||||||
|
--strip="${TOOLCHAIN_PREFIX}/i686-linux-android-strip" \
|
||||||
--extra-ldexeflags=-pie \
|
--extra-ldexeflags=-pie \
|
||||||
--disable-asm \
|
--disable-asm \
|
||||||
${COMMON_OPTIONS}
|
${COMMON_OPTIONS}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ EXOPLAYER_ROOT="$(pwd)"
|
||||||
FLAC_EXT_PATH="${EXOPLAYER_ROOT}/extensions/flac/src/main"
|
FLAC_EXT_PATH="${EXOPLAYER_ROOT}/extensions/flac/src/main"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Download the [Android NDK][] (version <= 17c) and set its location in an
|
* Download the [Android NDK][] and set its location in an environment variable.
|
||||||
environment variable:
|
This build configuration has been tested on NDK r20.
|
||||||
|
|
||||||
```
|
```
|
||||||
NDK_PATH="<path to Android NDK>"
|
NDK_PATH="<path to Android NDK>"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
APP_OPTIM := release
|
APP_OPTIM := release
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
APP_CPPFLAGS := -frtti
|
APP_CPPFLAGS := -frtti
|
||||||
APP_PLATFORM := android-14
|
APP_PLATFORM := android-14
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@ EXOPLAYER_ROOT="$(pwd)"
|
||||||
OPUS_EXT_PATH="${EXOPLAYER_ROOT}/extensions/opus/src/main"
|
OPUS_EXT_PATH="${EXOPLAYER_ROOT}/extensions/opus/src/main"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Download the [Android NDK][] and set its location in an environment variable:
|
* Download the [Android NDK][] and set its location in an environment variable.
|
||||||
|
This build configuration has been tested on NDK r20.
|
||||||
|
|
||||||
```
|
```
|
||||||
NDK_PATH="<path to Android NDK>"
|
NDK_PATH="<path to Android NDK>"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
APP_OPTIM := release
|
APP_OPTIM := release
|
||||||
APP_STL := gnustl_static
|
APP_STL := c++_static
|
||||||
APP_CPPFLAGS := -frtti
|
APP_CPPFLAGS := -frtti
|
||||||
APP_PLATFORM := android-9
|
APP_PLATFORM := android-9
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue