Merge branch 'v0.21.x'

This commit is contained in:
Max Kellermann 2020-01-14 22:04:55 +01:00
commit 64309abc14
4 changed files with 30 additions and 26 deletions

3
NEWS
View File

@ -31,7 +31,10 @@ ver 0.22 (not yet released)
- GCC 7 or clang 4 (or newer) recommended - GCC 7 or clang 4 (or newer) recommended
ver 0.21.19 (not yet released) 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 clang 10
* fix build failure with Android NDK r20
ver 0.21.18 (2019/12/24) ver 0.21.18 (2019/12/24)
* protocol * protocol

View File

@ -25,16 +25,15 @@ android_abis = {
'arch': 'arm-linux-androideabi', 'arch': 'arm-linux-androideabi',
'ndk_arch': 'arm', 'ndk_arch': 'arm',
'toolchain_arch': 'arm-linux-androideabi', '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', 'cflags': '-march=armv7-a -mfpu=vfp -mfloat-abi=softfp',
}, },
'arm64-v8a': { 'arm64-v8a': {
'android_api_level': '21',
'arch': 'aarch64-linux-android', 'arch': 'aarch64-linux-android',
'ndk_arch': 'arm64', 'ndk_arch': 'arm64',
'toolchain_arch': 'aarch64-linux-android', 'toolchain_arch': 'aarch64-linux-android',
'llvm_triple': 'aarch64-none-linux-android', 'llvm_triple': 'aarch64-linux-android',
'cflags': '', 'cflags': '',
}, },
@ -42,9 +41,17 @@ android_abis = {
'arch': 'i686-linux-android', 'arch': 'i686-linux-android',
'ndk_arch': 'x86', 'ndk_arch': 'x86',
'toolchain_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', '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 # select the NDK target
@ -76,24 +83,18 @@ class AndroidNdkToolchain:
ndk_arch = abi_info['ndk_arch'] ndk_arch = abi_info['ndk_arch']
android_api_level = '21' android_api_level = '21'
ndk_platform = 'android-' + android_api_level
# select the NDK compiler # select the NDK compiler
gcc_version = '4.9' 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') install_prefix = os.path.join(arch_path, 'root')
self.arch = arch self.arch = arch
self.install_prefix = install_prefix 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) 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_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 = '-Os -g'
common_flags += ' -fPIC' common_flags += ' -fPIC'
@ -107,6 +108,9 @@ class AndroidNdkToolchain:
common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections' 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.ar = os.path.join(toolchain_bin, arch + '-ar')
self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib') self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib')
self.nm = os.path.join(toolchain_bin, arch + '-nm') self.nm = os.path.join(toolchain_bin, arch + '-nm')
@ -114,15 +118,11 @@ class AndroidNdkToolchain:
self.cflags = common_flags self.cflags = common_flags
self.cxxflags = common_flags self.cxxflags = common_flags
self.cppflags = '--sysroot=' + sysroot + \ self.cppflags = ' -isystem ' + os.path.join(install_prefix, 'include')
' -isystem ' + os.path.join(install_prefix, 'include') + \ self.ldflags = ' -L' + os.path.join(install_prefix, 'lib') + \
' -isystem ' + os.path.join(sysroot, 'usr', 'include', arch) + \ ' -Wl,--exclude-libs=ALL' + \
' -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') + \
' ' + common_flags ' ' + common_flags
self.ldflags = common_flags
self.libs = '' self.libs = ''
self.is_arm = ndk_arch == 'arm' self.is_arm = ndk_arch == 'arm'
@ -130,13 +130,10 @@ class AndroidNdkToolchain:
self.is_aarch64 = ndk_arch == 'arm64' self.is_aarch64 = ndk_arch == 'arm64'
self.is_windows = False 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_flags = ''
libstdcxx_cxxflags = libstdcxx_flags + ' -isystem ' + os.path.join(libcxx_path, 'include') + ' -isystem ' + os.path.join(ndk_path, 'sources/android/support/include') libstdcxx_cxxflags = ''
libstdcxx_ldflags = libstdcxx_flags + ' -L' + libcxx_libs_path libstdcxx_ldflags = ''
libstdcxx_libs = '-lc++_static -lc++abi' libstdcxx_libs = '-static-libstdc++'
if self.is_armv7: if self.is_armv7:
# On 32 bit ARM, clang generates no ".eh_frame" section; # On 32 bit ARM, clang generates no ".eh_frame" section;

View File

@ -90,6 +90,10 @@ test_ldflags = [
] ]
if get_option('buildtype') != 'debug' if get_option('buildtype') != 'debug'
test_cxxflags += [
'-ffunction-sections',
'-fdata-sections',
]
test_cflags += [ test_cflags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',

View File

@ -658,7 +658,7 @@ PulseOutput::Open(AudioFormat &audio_format)
break; break;
} }
ss.rate = audio_format.sample_rate; ss.rate = std::min(audio_format.sample_rate, PA_RATE_MAX);
ss.channels = audio_format.channels; ss.channels = audio_format.channels;
/* create a stream .. */ /* create a stream .. */