diff --git a/NEWS b/NEWS index 9abdae646..bddcd2697 100644 --- a/NEWS +++ b/NEWS @@ -31,7 +31,10 @@ ver 0.22 (not yet released) - GCC 7 or clang 4 (or newer) recommended ver 0.21.19 (not yet released) +* output + - pulse: obey Pulse's maximum sample rate (fixes DSD128 playback) * fix build failure with clang 10 +* fix build failure with Android NDK r20 ver 0.21.18 (2019/12/24) * protocol diff --git a/android/build.py b/android/build.py index 23ec9f256..63e57f93e 100755 --- a/android/build.py +++ b/android/build.py @@ -25,16 +25,15 @@ android_abis = { 'arch': 'arm-linux-androideabi', 'ndk_arch': 'arm', 'toolchain_arch': 'arm-linux-androideabi', - 'llvm_triple': 'armv7-none-linux-androideabi', + 'llvm_triple': 'armv7-linux-androideabi', 'cflags': '-march=armv7-a -mfpu=vfp -mfloat-abi=softfp', }, 'arm64-v8a': { - 'android_api_level': '21', 'arch': 'aarch64-linux-android', 'ndk_arch': 'arm64', 'toolchain_arch': 'aarch64-linux-android', - 'llvm_triple': 'aarch64-none-linux-android', + 'llvm_triple': 'aarch64-linux-android', 'cflags': '', }, @@ -42,9 +41,17 @@ android_abis = { 'arch': 'i686-linux-android', 'ndk_arch': 'x86', 'toolchain_arch': 'x86', - 'llvm_triple': 'i686-none-linux-android', + 'llvm_triple': 'i686-linux-android', 'cflags': '-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32', }, + + 'x86_64': { + 'arch': 'x86_64-linux-android', + 'ndk_arch': 'x86_64', + 'toolchain_arch': 'x86_64', + 'llvm_triple': 'x86_64-linux-android', + 'cflags': '-m64', + }, } # select the NDK target @@ -76,24 +83,18 @@ class AndroidNdkToolchain: ndk_arch = abi_info['ndk_arch'] android_api_level = '21' - ndk_platform = 'android-' + android_api_level # select the NDK compiler gcc_version = '4.9' - ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform) - sysroot = os.path.join(ndk_path, 'sysroot') - target_root = os.path.join(ndk_platform_path, 'arch-' + ndk_arch) - install_prefix = os.path.join(arch_path, 'root') self.arch = arch self.install_prefix = install_prefix - self.sysroot = sysroot toolchain_path = os.path.join(ndk_path, 'toolchains', abi_info['toolchain_arch'] + '-' + gcc_version, 'prebuilt', build_arch) llvm_path = os.path.join(ndk_path, 'toolchains', 'llvm', 'prebuilt', build_arch) - llvm_triple = abi_info['llvm_triple'] + llvm_triple = abi_info['llvm_triple'] + android_api_level common_flags = '-Os -g' common_flags += ' -fPIC' @@ -107,6 +108,9 @@ class AndroidNdkToolchain: common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections' + # required flags from https://android.googlesource.com/platform/ndk/+/ndk-release-r20/docs/BuildSystemMaintainers.md#additional-required-arguments + common_flags += ' -fno-addrsig' + self.ar = os.path.join(toolchain_bin, arch + '-ar') self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib') self.nm = os.path.join(toolchain_bin, arch + '-nm') @@ -114,15 +118,11 @@ class AndroidNdkToolchain: self.cflags = common_flags self.cxxflags = common_flags - self.cppflags = '--sysroot=' + sysroot + \ - ' -isystem ' + os.path.join(install_prefix, 'include') + \ - ' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \ - ' -D__ANDROID_API__=' + android_api_level - self.ldflags = '--sysroot=' + sysroot + \ - ' -L' + os.path.join(install_prefix, 'lib') + \ - ' -L' + os.path.join(target_root, 'usr', 'lib') + \ - ' -B' + os.path.join(target_root, 'usr', 'lib') + \ + self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include') + self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \ + ' -Wl,--exclude-libs=ALL' + \ ' ' + common_flags + self.ldflags = common_flags self.libs = '' self.is_arm = ndk_arch == 'arm' @@ -130,13 +130,10 @@ class AndroidNdkToolchain: self.is_aarch64 = ndk_arch == 'arm64' self.is_windows = False - libcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/llvm-libc++') - libcxx_libs_path = os.path.join(libcxx_path, 'libs', android_abi) - libstdcxx_flags = '' - libstdcxx_cxxflags = libstdcxx_flags + ' -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include') - libstdcxx_ldflags = libstdcxx_flags + ' -L' + libcxx_libs_path - libstdcxx_libs = '-lc++_static -lc++abi' + libstdcxx_cxxflags = '' + libstdcxx_ldflags = '' + libstdcxx_libs = '-static-libstdc++' if self.is_armv7: # On 32 bit ARM, clang generates no ".eh_frame" section; diff --git a/meson.build b/meson.build index 526c31af5..4c2959c66 100644 --- a/meson.build +++ b/meson.build @@ -90,6 +90,10 @@ test_ldflags = [ ] if get_option('buildtype') != 'debug' + test_cxxflags += [ + '-ffunction-sections', + '-fdata-sections', + ] test_cflags += [ '-ffunction-sections', '-fdata-sections', diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index 527736b22..398af35ed 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -658,7 +658,7 @@ PulseOutput::Open(AudioFormat &audio_format) break; } - ss.rate = audio_format.sample_rate; + ss.rate = std::min(audio_format.sample_rate, PA_RATE_MAX); ss.channels = audio_format.channels; /* create a stream .. */