Update to 7.0.0 (2060)

This commit is contained in:
DrKLO 2020-08-14 19:58:22 +03:00
parent c0125f27ea
commit 321b756367
8001 changed files with 1605501 additions and 421684 deletions

View File

@ -1,5 +1,3 @@
import java.security.MessageDigest
apply plugin: 'com.android.application'
repositories {
@ -26,7 +24,7 @@ dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:20.2.3'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.firebase:firebase-config:19.2.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
@ -38,6 +36,8 @@ dependencies {
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation files('libs/libgsaverification-client.aar')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
}
android {
@ -68,6 +68,8 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
signingConfigs {
@ -277,12 +279,7 @@ android {
}
}
defaultConfig.versionCode = 2042
def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
def tgVoipDexClassesPath = "org/telegram/messenger/voip"
def dxUtilPath = "${sdkDirectory.path}/build-tools/${buildToolsVersion}/dx"
defaultConfig.versionCode = 2060
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -305,61 +302,6 @@ android {
file(manifestPath).write(manifestContent)
}
}
def assembleTgVoipDexTaskName = "assemble${variant.name.capitalize()}TgVoipDex"
task "${assembleTgVoipDexTaskName}" {
doLast {
def sourceDir = (File) android.sourceSets.main.java.srcDirs[0]
def classesDir = "${buildDir}/intermediates/javac/${variant.name}/classes"
def javaDir = "${buildDir}/intermediates/java_tgvoip/${variant.name}/java"
def tgVoipDir = new File(classesDir, tgVoipDexClassesPath)
def javaVoipDirFile = new File(javaDir, tgVoipDexClassesPath)
def tgVoipDexJavaFile = new File(javaVoipDirFile, "TgVoipDex.java")
if (!javaVoipDirFile.exists()) {
javaVoipDirFile.mkdirs()
}
def assetsDirFile = new File(buildDir, "intermediates/merged_assets/${variant.name}/out")
if (!assetsDirFile.exists()) {
assetsDirFile.mkdirs()
}
def tgVoipDexFile = new File(assetsDirFile, tgVoipDexFileName)
def classes = tgVoipDir.list(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
// handle inner and anonymous classes
return tgVoipDexClasses.any { name == "${it}.class" || name.startsWith("${it}\$") && name.endsWith(".class") }
}
}).collect { "${tgVoipDexClassesPath}/${it}" }
// 1. create libtgvoip.dex
exec {
workingDir classesDir
commandLine([dxUtilPath, "--dex", "--output=${tgVoipDexFile}"] + classes)
}
// 2. remove classes from the main dex
project.delete classes.collect { "${classesDir}/${it}" }
// 3. insert checksum of libtgvoip.dex into TgVoipDex.java
def digest = MessageDigest.getInstance("SHA1")
def fileInputStream = tgVoipDexFile.newInputStream()
def buffer = new byte[4096]
def len
while ((len = fileInputStream.read(buffer)) > 0) {
digest.update(buffer, 0, len)
}
def dexChecksum = new String(Base64.getEncoder().encode(digest.digest())).trim()
tgVoipDexJavaFile.write(new String(new File(sourceDir, "${tgVoipDexClassesPath}/TgVoipDex.java").readBytes()).replace("\$CHECKSUM\$", dexChecksum))
exec {
commandLine([findJavac(), "-d", classesDir, tgVoipDexJavaFile.absolutePath])
}
}
}
tasks.findByName("compile${variant.name.capitalize()}JavaWithJavac").finalizedBy(assembleTgVoipDexTaskName)
tasks.findByName("${assembleTgVoipDexTaskName}").mustRunAfter tasks.findByName("merge${variant.name.capitalize()}Assets")
}
variantFilter { variant ->
@ -372,44 +314,17 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "6.3.0"
versionName "7.0.0"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
externalNativeBuild {
ndkBuild {
arguments "NDK_APPLICATION_MK:=jni/Application.mk", "APP_PLATFORM:=android-16", "--jobs=8", "LOCAL_ARM_NEON:=false"
arguments "NDK_APPLICATION_MK:=jni/Application.mk", "APP_PLATFORM:=android-16", "--jobs=16"
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
}
}
private static File findJavaHome() {
String javaPath = System.getProperty("java.home")
if (javaPath != null) {
File javaBase = new File(javaPath)
if (javaBase.exists()) {
if (javaBase.getName().equalsIgnoreCase("jre") && new File(javaBase.getParentFile(), "bin/java").exists()) {
return javaBase.getParentFile()
} else {
return javaBase
}
} else {
return null
}
} else {
return null
}
}
private static File findJavac() {
File javaHome = findJavaHome()
if (javaHome != null) {
return new File(javaHome, "bin/javac")
} else {
return null
}
}
apply plugin: 'com.google.gms.google-services'

View File

@ -1,5 +1,4 @@
MY_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(MY_LOCAL_PATH)
LOCAL_PATH := $(call my-dir)
LOCAL_MODULE := avutil
@ -97,18 +96,23 @@ include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
TGVOIP_NATIVE_VERSION := 1.1
TGVOIP_ADDITIONAL_CFLAGS := -DTGVOIP_NO_VIDEO
include $(MY_LOCAL_PATH)/libtgvoip/Android.mk
LOCAL_PATH := $(MY_LOCAL_PATH) # restore local path after include
include $(CLEAR_VARS)
LOCAL_MODULE := ssl
TGVOIP_NATIVE_VERSION := 3.1
TGVOIP_ADDITIONAL_CFLAGS := -DTGVOIP_NO_VIDEO
include $(MY_LOCAL_PATH)/libtgvoip3/Android.mk
LOCAL_PATH := $(MY_LOCAL_PATH) # restore local path after include
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_armeabi-v7a.a
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_arm64-v8a.a
else ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_x86.a
else ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_SRC_FILES := ./boringssl/lib/libssl_x86_64.a
endif
include $(PREBUILT_STATIC_LIBRARY)
include ./jni/TgCalls.mk
include $(CLEAR_VARS)
LOCAL_CPPFLAGS := -Wall -std=c++14 -DANDROID -frtti -DHAVE_PTHREAD -finline-functions -ffast-math -Os
LOCAL_C_INCLUDES += ./jni/boringssl/include/
@ -294,8 +298,8 @@ LOCAL_ARM_MODE := arm
LOCAL_MODULE := rlottie
LOCAL_CPPFLAGS := -DNDEBUG -Wall -std=c++14 -DANDROID -fno-rtti -DHAVE_PTHREAD -finline-functions -ffast-math -Os -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wnon-virtual-dtor -Woverloaded-virtual -Wno-unused-parameter -fvisibility=hidden
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),armeabi-v7a))
LOCAL_CFLAGS := -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CFLAGS := -DUSE_ARM_NEON -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -fno-integrated-as
else ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),arm64-v8a))
LOCAL_CFLAGS := -DUSE_ARM_NEON -D__ARM64_NEON__ -fno-integrated-as
LOCAL_CPPFLAGS += -DUSE_ARM_NEON -D__ARM64_NEON__ -fno-integrated-as
@ -353,13 +357,15 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := tmessages.31
LOCAL_MODULE := tmessages.32
LOCAL_CFLAGS := -w -std=c11 -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -Os -funroll-loops -std=c++14
LOCAL_LDLIBS := -ljnigraphics -llog -lz -lEGL -lGLESv2 -landroid
LOCAL_LDLIBS := -ljnigraphics -llog -lz -lEGL -lGLESv2 -landroid -lOpenSLES
LOCAL_STATIC_LIBRARIES := webp sqlite lz4 rlottie tgnet swscale avformat avcodec avresample avutil flac
LOCAL_WHOLE_STATIC_LIBRARIES := tgcalls
LOCAL_ARM_NEON := false
LOCAL_SRC_FILES := \
./opus/src/opus.c \
@ -399,7 +405,7 @@ else
LOCAL_CPPFLAGS += -Dx86fix
LOCAL_ARM_MODE := arm
# LOCAL_SRC_FILES += \
# ./libyuv/source/row_x86.asm
# ./third_party/libyuv/source/row_x86.asm
# LOCAL_SRC_FILES += \
# ./opus/celt/x86/celt_lpc_sse.c \
@ -560,7 +566,7 @@ LOCAL_C_INCLUDES := \
./jni/opus/celt \
./jni/opus/ \
./jni/opus/opusfile \
./jni/libyuv/include \
./jni/third_party/libyuv/include \
./jni/boringssl/include \
./jni/ffmpeg/include \
./jni/emoji \
@ -568,57 +574,55 @@ LOCAL_C_INCLUDES := \
./jni/exoplayer/libFLAC/include \
./jni/intro \
./jni/rlottie/inc \
./jni/ton \
./jni/tgcalls/ \
./jni/webrtc/ \
./jni/lz4
LOCAL_SRC_FILES += \
./libyuv/source/compare_common.cc \
./libyuv/source/compare_gcc.cc \
./libyuv/source/compare_neon64.cc \
./libyuv/source/compare_win.cc \
./libyuv/source/compare.cc \
./libyuv/source/convert_argb.cc \
./libyuv/source/convert_from_argb.cc \
./libyuv/source/convert_from.cc \
./libyuv/source/convert_jpeg.cc \
./libyuv/source/convert_to_argb.cc \
./libyuv/source/convert_to_i420.cc \
./libyuv/source/convert.cc \
./libyuv/source/cpu_id.cc \
./libyuv/source/mjpeg_decoder.cc \
./libyuv/source/mjpeg_validate.cc \
./libyuv/source/planar_functions.cc \
./libyuv/source/rotate_any.cc \
./libyuv/source/rotate_argb.cc \
./libyuv/source/rotate_common.cc \
./libyuv/source/rotate_gcc.cc \
./libyuv/source/rotate_mips.cc \
./libyuv/source/rotate_neon64.cc \
./libyuv/source/rotate_win.cc \
./libyuv/source/rotate.cc \
./libyuv/source/row_any.cc \
./libyuv/source/row_common.cc \
./libyuv/source/row_gcc.cc \
./libyuv/source/row_mips.cc \
./libyuv/source/row_neon64.cc \
./libyuv/source/row_win.cc \
./libyuv/source/scale_any.cc \
./libyuv/source/scale_argb.cc \
./libyuv/source/scale_common.cc \
./libyuv/source/scale_gcc.cc \
./libyuv/source/scale_mips.cc \
./libyuv/source/scale_neon64.cc \
./libyuv/source/scale_win.cc \
./libyuv/source/scale.cc \
./libyuv/source/video_common.cc
./third_party/libyuv/source/compare_common.cc \
./third_party/libyuv/source/compare_gcc.cc \
./third_party/libyuv/source/compare_neon64.cc \
./third_party/libyuv/source/compare_win.cc \
./third_party/libyuv/source/compare.cc \
./third_party/libyuv/source/convert_argb.cc \
./third_party/libyuv/source/convert_from_argb.cc \
./third_party/libyuv/source/convert_from.cc \
./third_party/libyuv/source/convert_jpeg.cc \
./third_party/libyuv/source/convert_to_argb.cc \
./third_party/libyuv/source/convert_to_i420.cc \
./third_party/libyuv/source/convert.cc \
./third_party/libyuv/source/cpu_id.cc \
./third_party/libyuv/source/mjpeg_decoder.cc \
./third_party/libyuv/source/mjpeg_validate.cc \
./third_party/libyuv/source/planar_functions.cc \
./third_party/libyuv/source/rotate_any.cc \
./third_party/libyuv/source/rotate_argb.cc \
./third_party/libyuv/source/rotate_common.cc \
./third_party/libyuv/source/rotate_gcc.cc \
./third_party/libyuv/source/rotate_neon64.cc \
./third_party/libyuv/source/rotate_win.cc \
./third_party/libyuv/source/rotate.cc \
./third_party/libyuv/source/row_any.cc \
./third_party/libyuv/source/row_common.cc \
./third_party/libyuv/source/row_gcc.cc \
./third_party/libyuv/source/row_neon64.cc \
./third_party/libyuv/source/row_win.cc \
./third_party/libyuv/source/scale_any.cc \
./third_party/libyuv/source/scale_argb.cc \
./third_party/libyuv/source/scale_common.cc \
./third_party/libyuv/source/scale_gcc.cc \
./third_party/libyuv/source/scale_neon64.cc \
./third_party/libyuv/source/scale_win.cc \
./third_party/libyuv/source/scale.cc \
./third_party/libyuv/source/video_common.cc
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS += -DLIBYUV_NEON
LOCAL_SRC_FILES += \
./libyuv/source/compare_neon.cc.neon \
./libyuv/source/rotate_neon.cc.neon \
./libyuv/source/row_neon.cc.neon \
./libyuv/source/scale_neon.cc.neon
./third_party/libyuv/source/compare_neon.cc.neon \
./third_party/libyuv/source/rotate_neon.cc.neon \
./third_party/libyuv/source/row_neon.cc.neon \
./third_party/libyuv/source/scale_neon.cc.neon
endif
LOCAL_SRC_FILES += \

2061
TMessagesProj/jni/TgCalls.mk Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ cmake, ninja, go are required
export ANDROID_NDK=/Applications/sdk/ndk-bundle
/Applications/sdk/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=armeabi-v7a \
/Applications/sdk/cmake/3.10.2.4988404/bin/cmake -DANDROID_ABI=armeabi-v7a \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=16 \
-DCMAKE_BUILD_TYPE=Release \
@ -10,25 +10,25 @@ export ANDROID_NDK=/Applications/sdk/ndk-bundle
-DOPENSSL_NO_ASM=1 \
-GNinja ..
/Applications/sdk/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=x86 \
/Applications/sdk/cmake/3.10.2.4988404/bin/cmake -DANDROID_ABI=x86 \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=16 \
-DCMAKE_BUILD_TYPE=Release \
-DARCH=x86 \
-GNinja ..
/Applications/sdk/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=x86_64 \
/Applications/sdk/cmake/3.10.2.4988404/bin/cmake -DANDROID_ABI=x86_64 \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=21 \
-DCMAKE_BUILD_TYPE=Release \
-DARCH=x86_64 \
-GNinja ..
/Applications/sdk/cmake/3.6.4111459/bin/cmake -DANDROID_ABI=arm64-v8a \
/Applications/sdk/cmake/3.10.2.4988404/bin/cmake -DANDROID_ABI=arm64-v8a \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=21 \
-DCMAKE_BUILD_TYPE=Release \
-DARCH=arm64-v8a \
-GNinja ..
/Applications/sdk/cmake/3.6.4111459/bin/cmake --build .
/Applications/sdk/cmake/3.10.2.4988404/bin/cmake --build .

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,13 +9,12 @@
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#include <libtgvoip/client/android/org_telegram_messenger_voip_TgVoip.h>
#include "libtgvoip/client/android/tg_voip_jni.h"
int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env);
int videoOnJNILoad(JavaVM *vm, JNIEnv *env);
int imageOnJNILoad(JavaVM *vm, JNIEnv *env);
//int tonLibOnLoad(JavaVM *vm, JNIEnv *env);
int webrtcOnJNILoad(JavaVM *vm, JNIEnv *env);
int tgvoipOnJNILoad(JavaVM *vm, JNIEnv *env);
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env = 0;
@ -24,7 +23,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_6) != JNI_OK) {
return -1;
}
if (imageOnJNILoad(vm, env) != JNI_TRUE) {
return -1;
}
@ -37,13 +36,14 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
return -1;
}
/* if (tgvoipOnJniLoad(vm, env) != JNI_TRUE) {
if (webrtcOnJNILoad(vm, env) != JNI_TRUE) {
return -1;
}*/
//tonLibOnLoad(vm, env);
//tgvoipRegisterNatives(env);
}
if (tgvoipOnJNILoad(vm, env) != JNI_TRUE) {
return -1;
}
return JNI_VERSION_1_6;
}

View File

@ -1,26 +0,0 @@
.DS_Store
bin
.idea
build
*/Debug/*
*/Release/*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Pp]review/
[Pp]roduction/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
DerivedData/
# Visual Studio 2015 cache/options directory
.vs/
xcuserdata/
autom4te.cache/

View File

@ -1,560 +0,0 @@
LOCAL_PATH := $(call my-dir)
LOCAL_MODULE := tgvoip${TGVOIP_NATIVE_VERSION}
LOCAL_CPPFLAGS := -Wall -std=c++11 -DANDROID -finline-functions -ffast-math -Os -fno-strict-aliasing -O3 -frtti -D__STDC_LIMIT_MACROS -Wno-unknown-pragmas
LOCAL_CPPFLAGS += -DBSD=1 -funroll-loops
LOCAL_CFLAGS := -O3 -DUSE_KISS_FFT -fexceptions -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_POSIX -DWEBRTC_ANDROID -D__STDC_LIMIT_MACROS -DWEBRTC_NS_FLOAT
LOCAL_CFLAGS += -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_LDLIBS := -llog -lOpenSLES
LOCAL_STATIC_LIBRARIES := crypto
MY_DIR := libtgvoip
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../opus/include \
$(LOCAL_PATH)/../opus/silk \
$(LOCAL_PATH)/../opus/silk/fixed \
$(LOCAL_PATH)/../opus/celt \
$(LOCAL_PATH)/../opus/ \
$(LOCAL_PATH)/../opus/opusfile \
$(LOCAL_PATH)/../boringssl/include/ \
$(LOCAL_PATH)/webrtc_dsp/
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),armeabi-v7a arm64-v8a))
CC_NEON := cc.neon
LOCAL_CFLAGS += -DWEBRTC_HAS_NEON
else
CC_NEON := cc
endif
LOCAL_CFLAGS += $(TGVOIP_ADDITIONAL_CFLAGS)
LOCAL_SRC_FILES := \
./logging.cpp \
./TgVoip.cpp \
./VoIPController.cpp \
./VoIPGroupController.cpp \
./Buffers.cpp \
./BlockingQueue.cpp \
./audio/AudioInput.cpp \
./os/android/AudioInputOpenSLES.cpp \
./MediaStreamItf.cpp \
./audio/AudioOutput.cpp \
./OpusEncoder.cpp \
./os/android/AudioOutputOpenSLES.cpp \
./JitterBuffer.cpp \
./OpusDecoder.cpp \
./os/android/OpenSLEngineWrapper.cpp \
./os/android/AudioInputAndroid.cpp \
./os/android/AudioOutputAndroid.cpp \
./EchoCanceller.cpp \
./CongestionControl.cpp \
./VoIPServerConfig.cpp \
./audio/Resampler.cpp \
./NetworkSocket.cpp \
./os/posix/NetworkSocketPosix.cpp \
./PacketReassembler.cpp \
./MessageThread.cpp \
./json11.cpp \
./audio/AudioIO.cpp \
./video/VideoRenderer.cpp \
./video/VideoSource.cpp \
./video/ScreamCongestionController.cpp \
./os/android/VideoSourceAndroid.cpp \
./os/android/VideoRendererAndroid.cpp \
./client/android/org_telegram_messenger_voip_TgVoip.cpp \
./client/android/tg_voip_jni.cpp
# WebRTC signal processing
LOCAL_SRC_FILES += \
./webrtc_dsp/system_wrappers/source/field_trial.cc \
./webrtc_dsp/system_wrappers/source/metrics.cc \
./webrtc_dsp/system_wrappers/source/cpu_features.cc \
./webrtc_dsp/absl/strings/internal/memutil.cc \
./webrtc_dsp/absl/strings/string_view.cc \
./webrtc_dsp/absl/strings/ascii.cc \
./webrtc_dsp/absl/types/bad_optional_access.cc \
./webrtc_dsp/absl/types/optional.cc \
./webrtc_dsp/absl/base/internal/raw_logging.cc \
./webrtc_dsp/absl/base/internal/throw_delegate.cc \
./webrtc_dsp/rtc_base/race_checker.cc \
./webrtc_dsp/rtc_base/strings/string_builder.cc \
./webrtc_dsp/rtc_base/memory/aligned_malloc.cc \
./webrtc_dsp/rtc_base/timeutils.cc \
./webrtc_dsp/rtc_base/platform_file.cc \
./webrtc_dsp/rtc_base/string_to_number.cc \
./webrtc_dsp/rtc_base/thread_checker_impl.cc \
./webrtc_dsp/rtc_base/stringencode.cc \
./webrtc_dsp/rtc_base/stringutils.cc \
./webrtc_dsp/rtc_base/checks.cc \
./webrtc_dsp/rtc_base/platform_thread.cc \
./webrtc_dsp/rtc_base/criticalsection.cc \
./webrtc_dsp/rtc_base/platform_thread_types.cc \
./webrtc_dsp/rtc_base/event.cc \
./webrtc_dsp/rtc_base/event_tracer.cc \
./webrtc_dsp/rtc_base/logging_webrtc.cc \
./webrtc_dsp/third_party/rnnoise/src/rnn_vad_weights.cc \
./webrtc_dsp/third_party/rnnoise/src/kiss_fft.cc \
./webrtc_dsp/api/audio/audio_frame.cc \
./webrtc_dsp/api/audio/echo_canceller3_config.cc \
./webrtc_dsp/api/audio/echo_canceller3_factory.cc \
./webrtc_dsp/modules/third_party/fft/fft.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filterbanks.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/transform.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_filter.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filter_functions.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lattice.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/intialize.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/entropy_coding.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_vad.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/crc.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode_bwe.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac.c \
./webrtc_dsp/modules/audio_processing/rms_level.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/normalized_covariance_estimator.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/moving_max.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/circular_buffer.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/mean_variance_estimator.cc \
./webrtc_dsp/modules/audio_processing/splitting_filter.cc \
./webrtc_dsp/modules/audio_processing/gain_control_impl.cc \
./webrtc_dsp/modules/audio_processing/ns/nsx_core.c \
./webrtc_dsp/modules/audio_processing/ns/noise_suppression_x.c \
./webrtc_dsp/modules/audio_processing/ns/nsx_core_c.c \
./webrtc_dsp/modules/audio_processing/ns/ns_core.c \
./webrtc_dsp/modules/audio_processing/ns/noise_suppression.c \
./webrtc_dsp/modules/audio_processing/audio_buffer.cc \
./webrtc_dsp/modules/audio_processing/typing_detection.cc \
./webrtc_dsp/modules/audio_processing/include/audio_processing_statistics.cc \
./webrtc_dsp/modules/audio_processing/include/audio_generator_factory.cc \
./webrtc_dsp/modules/audio_processing/include/aec_dump.cc \
./webrtc_dsp/modules/audio_processing/include/audio_processing.cc \
./webrtc_dsp/modules/audio_processing/include/config.cc \
./webrtc_dsp/modules/audio_processing/agc2/interpolated_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/agc2_common.cc \
./webrtc_dsp/modules/audio_processing/agc2/gain_applier.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_agc.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_digital_gain_applier.cc \
./webrtc_dsp/modules/audio_processing/agc2/limiter.cc \
./webrtc_dsp/modules/audio_processing/agc2/saturation_protector.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/rnn.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search_internal.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/features_extraction.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/fft_util.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/lp_residual.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.cc \
./webrtc_dsp/modules/audio_processing/agc2/vector_float_frame.cc \
./webrtc_dsp/modules/audio_processing/agc2/noise_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/agc2_testing_common.cc \
./webrtc_dsp/modules/audio_processing/agc2/fixed_digital_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/fixed_gain_controller.cc \
./webrtc_dsp/modules/audio_processing/agc2/vad_with_level.cc \
./webrtc_dsp/modules/audio_processing/agc2/limiter_db_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/down_sampler.cc \
./webrtc_dsp/modules/audio_processing/agc2/signal_classifier.cc \
./webrtc_dsp/modules/audio_processing/agc2/noise_spectrum_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/compute_interpolated_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/biquad_filter.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/transient/moving_moments.cc \
./webrtc_dsp/modules/audio_processing/transient/wpd_tree.cc \
./webrtc_dsp/modules/audio_processing/transient/wpd_node.cc \
./webrtc_dsp/modules/audio_processing/transient/transient_suppressor.cc \
./webrtc_dsp/modules/audio_processing/transient/transient_detector.cc \
./webrtc_dsp/modules/audio_processing/low_cut_filter.cc \
./webrtc_dsp/modules/audio_processing/level_estimator_impl.cc \
./webrtc_dsp/modules/audio_processing/three_band_filter_bank.cc \
./webrtc_dsp/modules/audio_processing/aec/echo_cancellation.cc \
./webrtc_dsp/modules/audio_processing/aec/aec_resampler.cc \
./webrtc_dsp/modules/audio_processing/aec/aec_core.cc \
./webrtc_dsp/modules/audio_processing/voice_detection_impl.cc \
./webrtc_dsp/modules/audio_processing/echo_cancellation_impl.cc \
./webrtc_dsp/modules/audio_processing/gain_control_for_experimental_agc.cc \
./webrtc_dsp/modules/audio_processing/agc/agc.cc \
./webrtc_dsp/modules/audio_processing/agc/loudness_histogram.cc \
./webrtc_dsp/modules/audio_processing/agc/agc_manager_direct.cc \
./webrtc_dsp/modules/audio_processing/agc/legacy/analog_agc.c \
./webrtc_dsp/modules/audio_processing/agc/legacy/digital_agc.c \
./webrtc_dsp/modules/audio_processing/agc/utility.cc \
./webrtc_dsp/modules/audio_processing/audio_processing_impl.cc \
./webrtc_dsp/modules/audio_processing/audio_generator/file_audio_generator.cc \
./webrtc_dsp/modules/audio_processing/gain_controller2.cc \
./webrtc_dsp/modules/audio_processing/residual_echo_detector.cc \
./webrtc_dsp/modules/audio_processing/noise_suppression_impl.cc \
./webrtc_dsp/modules/audio_processing/aecm/aecm_core.cc \
./webrtc_dsp/modules/audio_processing/aecm/aecm_core_c.cc \
./webrtc_dsp/modules/audio_processing/aecm/echo_control_mobile.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_reverb_model.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model_fallback.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_remover_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer2.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_path_variability.cc \
./webrtc_dsp/modules/audio_processing/aec3/frame_blocker.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec3_fft.cc \
./webrtc_dsp/modules/audio_processing/aec3/fullband_erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_filter.$(CC_NEON) \
./webrtc_dsp/modules/audio_processing/aec3/block_processor.cc \
./webrtc_dsp/modules/audio_processing/aec3/subband_erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/vector_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/erl_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec_state.cc \
./webrtc_dsp/modules/audio_processing/aec3/adaptive_fir_filter.$(CC_NEON) \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller.cc \
./webrtc_dsp/modules/audio_processing/aec3/skew_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_path_delay_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_framer.cc \
./webrtc_dsp/modules/audio_processing/aec3/erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model.cc \
./webrtc_dsp/modules/audio_processing/aec3/cascaded_biquad_filter.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor_output.cc \
./webrtc_dsp/modules/audio_processing/aec3/stationarity_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_signal_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor_output_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_gain.$(CC_NEON) \
./webrtc_dsp/modules/audio_processing/aec3/echo_audibility.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_processor_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/moving_average.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec3_common.cc \
./webrtc_dsp/modules/audio_processing/aec3/residual_echo_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/matched_filter.$(CC_NEON) \
./webrtc_dsp/modules/audio_processing/aec3/reverb_decay_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller2.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_gain_limiter.cc \
./webrtc_dsp/modules/audio_processing/aec3/main_filter_update_gain.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_remover.cc \
./webrtc_dsp/modules/audio_processing/aec3/downsampled_render_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/matrix_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_processor2.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_canceller3.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_delay_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/fft_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/comfort_noise_generator.$(CC_NEON) \
./webrtc_dsp/modules/audio_processing/aec3/shadow_filter_update_gain.cc \
./webrtc_dsp/modules/audio_processing/aec3/filter_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_frequency_response.cc \
./webrtc_dsp/modules/audio_processing/aec3/decimator.cc \
./webrtc_dsp/modules/audio_processing/echo_control_mobile_impl.cc \
./webrtc_dsp/modules/audio_processing/logging/apm_data_dumper.cc \
./webrtc_dsp/modules/audio_processing/vad/voice_activity_detector.cc \
./webrtc_dsp/modules/audio_processing/vad/standalone_vad.cc \
./webrtc_dsp/modules/audio_processing/vad/pitch_internal.cc \
./webrtc_dsp/modules/audio_processing/vad/vad_circular_buffer.cc \
./webrtc_dsp/modules/audio_processing/vad/vad_audio_proc.cc \
./webrtc_dsp/modules/audio_processing/vad/pole_zero_filter.cc \
./webrtc_dsp/modules/audio_processing/vad/pitch_based_vad.cc \
./webrtc_dsp/modules/audio_processing/vad/gmm.cc \
./webrtc_dsp/modules/audio_processing/utility/ooura_fft.cc \
./webrtc_dsp/modules/audio_processing/utility/delay_estimator_wrapper.cc \
./webrtc_dsp/modules/audio_processing/utility/delay_estimator.cc \
./webrtc_dsp/modules/audio_processing/utility/block_mean_calculator.cc \
./webrtc_dsp/common_audio/window_generator.cc \
./webrtc_dsp/common_audio/channel_buffer.cc \
./webrtc_dsp/common_audio/fir_filter_factory.cc \
./webrtc_dsp/common_audio/wav_header.cc \
./webrtc_dsp/common_audio/real_fourier_ooura.cc \
./webrtc_dsp/common_audio/audio_util.cc \
./webrtc_dsp/common_audio/resampler/push_sinc_resampler.cc \
./webrtc_dsp/common_audio/resampler/resampler.cc \
./webrtc_dsp/common_audio/resampler/push_resampler.cc \
./webrtc_dsp/common_audio/resampler/sinc_resampler.cc \
./webrtc_dsp/common_audio/resampler/sinusoidal_linear_chirp_source.cc \
./webrtc_dsp/common_audio/wav_file.cc \
./webrtc_dsp/common_audio/third_party/fft4g/fft4g.c \
./webrtc_dsp/common_audio/audio_converter.cc \
./webrtc_dsp/common_audio/real_fourier.cc \
./webrtc_dsp/common_audio/sparse_fir_filter.cc \
./webrtc_dsp/common_audio/smoothing_filter.cc \
./webrtc_dsp/common_audio/fir_filter_c.cc \
./webrtc_dsp/common_audio/ring_buffer.c \
./webrtc_dsp/common_audio/signal_processing/complex_fft.c \
./webrtc_dsp/common_audio/signal_processing/filter_ma_fast_q12.c \
./webrtc_dsp/common_audio/signal_processing/levinson_durbin.c \
./webrtc_dsp/common_audio/signal_processing/dot_product_with_scale.cc \
./webrtc_dsp/common_audio/signal_processing/auto_corr_to_refl_coef.c \
./webrtc_dsp/common_audio/signal_processing/resample_by_2_internal.c \
./webrtc_dsp/common_audio/signal_processing/energy.c \
./webrtc_dsp/common_audio/signal_processing/sqrt_of_one_minus_x_squared.c \
./webrtc_dsp/common_audio/signal_processing/downsample_fast.c \
./webrtc_dsp/common_audio/signal_processing/splitting_filter1.c \
./webrtc_dsp/common_audio/signal_processing/spl_init.c \
./webrtc_dsp/common_audio/signal_processing/lpc_to_refl_coef.c \
./webrtc_dsp/common_audio/signal_processing/cross_correlation.c \
./webrtc_dsp/common_audio/signal_processing/division_operations.c \
./webrtc_dsp/common_audio/signal_processing/auto_correlation.c \
./webrtc_dsp/common_audio/signal_processing/get_scaling_square.c \
./webrtc_dsp/common_audio/signal_processing/resample.c \
./webrtc_dsp/common_audio/signal_processing/min_max_operations.c \
./webrtc_dsp/common_audio/signal_processing/refl_coef_to_lpc.c \
./webrtc_dsp/common_audio/signal_processing/filter_ar.c \
./webrtc_dsp/common_audio/signal_processing/vector_scaling_operations.c \
./webrtc_dsp/common_audio/signal_processing/resample_fractional.c \
./webrtc_dsp/common_audio/signal_processing/real_fft.c \
./webrtc_dsp/common_audio/signal_processing/ilbc_specific_functions.c \
./webrtc_dsp/common_audio/signal_processing/randomization_functions.c \
./webrtc_dsp/common_audio/signal_processing/copy_set_operations.c \
./webrtc_dsp/common_audio/signal_processing/resample_by_2.c \
./webrtc_dsp/common_audio/signal_processing/get_hanning_window.c \
./webrtc_dsp/common_audio/signal_processing/resample_48khz.c \
./webrtc_dsp/common_audio/signal_processing/spl_inl.c \
./webrtc_dsp/common_audio/signal_processing/spl_sqrt.c \
./webrtc_dsp/common_audio/vad/vad_sp.c \
./webrtc_dsp/common_audio/vad/vad.cc \
./webrtc_dsp/common_audio/vad/webrtc_vad.c \
./webrtc_dsp/common_audio/vad/vad_filterbank.c \
./webrtc_dsp/common_audio/vad/vad_core.c \
./webrtc_dsp/common_audio/vad/vad_gmm.c
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),armeabi-v7a arm64-v8a))
LOCAL_SRC_FILES += \
./webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.c.neon \
./webrtc_dsp/modules/audio_processing/aec/aec_core_neon.cc.neon \
./webrtc_dsp/modules/audio_processing/aecm/aecm_core_neon.cc.neon \
./webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc.neon \
./webrtc_dsp/common_audio/fir_filter_neon.cc.neon \
./webrtc_dsp/common_audio/resampler/sinc_resampler_neon.cc.neon \
./webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.c.neon \
./webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.c.neon \
./webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.c.neon
endif
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES += \
./webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S.neon \
./webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S.neon \
./webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S.neon
else
LOCAL_SRC_FILES += \
./webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c \
./webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \
./webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12.c
endif
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),x86 x86_64))
LOCAL_SRC_FILES += \
./webrtc_dsp/modules/audio_processing/aec/aec_core_sse2.cc \
./webrtc_dsp/modules/audio_processing/utility/ooura_fft_sse2.cc \
./webrtc_dsp/common_audio/fir_filter_sse.cc \
./webrtc_dsp/common_audio/resampler/sinc_resampler_sse.cc
endif
# Opus
LOCAL_SRC_FILES += \
./../opus/src/opus.c \
./../opus/src/opus_decoder.c \
./../opus/src/opus_encoder.c \
./../opus/src/opus_multistream.c \
./../opus/src/opus_multistream_encoder.c \
./../opus/src/opus_multistream_decoder.c \
./../opus/src/repacketizer.c \
./../opus/src/analysis.c \
./../opus/src/mlp.c \
./../opus/src/mlp_data.c \
./../opus/src/opus_projection_encoder.c \
./../opus/src/opus_projection_decoder.c \
./../opus/src/mapping_matrix.c
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI),armeabi-v7a arm64-v8a))
LOCAL_ARM_MODE := arm
LOCAL_CPPFLAGS += -DLIBYUV_NEON
LOCAL_CFLAGS += -DLIBYUV_NEON
LOCAL_CFLAGS += -DOPUS_HAVE_RTCD -DOPUS_ARM_ASM
LOCAL_SRC_FILES += \
./../opus/celt/arm/celt_neon_intr.c.neon \
./../opus/celt/arm/pitch_neon_intr.c.neon \
./../opus/silk/arm/NSQ_neon.c.neon \
./../opus/silk/arm/arm_silk_map.c \
./../opus/silk/arm/LPC_inv_pred_gain_neon_intr.c.neon \
./../opus/silk/arm/NSQ_del_dec_neon_intr.c.neon \
./../opus/silk/arm/biquad_alt_neon_intr.c.neon \
./../opus/silk/fixed/arm/warped_autocorrelation_FIX_neon_intr.c.neon
# LOCAL_SRC_FILES += ./../opus/celt/arm/celt_pitch_xcorr_arm-gnu.S
else
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CFLAGS += -Dx86fix
LOCAL_CPPFLAGS += -Dx86fix
LOCAL_ARM_MODE := arm
# LOCAL_SRC_FILES += \
# ./libyuv/source/row_x86.asm
# LOCAL_SRC_FILES += \
# ./../opus/celt/x86/celt_lpc_sse.c \
# ./../opus/celt/x86/pitch_sse.c \
# ./../opus/celt/x86/pitch_sse2.c \
# ./../opus/celt/x86/pitch_sse4_1.c \
# ./../opus/celt/x86/vq_sse2.c \
# ./../opus/celt/x86/x86_celt_map.c \
# ./../opus/celt/x86/x86cpu.c \
# ./../opus/silk/fixed/x86/burg_modified_FIX_sse.c \
# ./../opus/silk/fixed/x86/vector_ops_FIX_sse.c \
# ./../opus/silk/x86/NSQ_del_dec_sse.c \
# ./../opus/silk/x86/NSQ_sse.c \
# ./../opus/silk/x86/VAD_sse.c \
# ./../opus/silk/x86/VQ_WMat_sse.c \
# ./../opus/silk/x86/x86_silk_map.c
endif
endif
LOCAL_SRC_FILES += \
./../opus/silk/CNG.c \
./../opus/silk/code_signs.c \
./../opus/silk/init_decoder.c \
./../opus/silk/decode_core.c \
./../opus/silk/decode_frame.c \
./../opus/silk/decode_parameters.c \
./../opus/silk/decode_indices.c \
./../opus/silk/decode_pulses.c \
./../opus/silk/decoder_set_fs.c \
./../opus/silk/dec_API.c \
./../opus/silk/enc_API.c \
./../opus/silk/encode_indices.c \
./../opus/silk/encode_pulses.c \
./../opus/silk/gain_quant.c \
./../opus/silk/interpolate.c \
./../opus/silk/LP_variable_cutoff.c \
./../opus/silk/NLSF_decode.c \
./../opus/silk/NSQ.c \
./../opus/silk/NSQ_del_dec.c \
./../opus/silk/PLC.c \
./../opus/silk/shell_coder.c \
./../opus/silk/tables_gain.c \
./../opus/silk/tables_LTP.c \
./../opus/silk/tables_NLSF_CB_NB_MB.c \
./../opus/silk/tables_NLSF_CB_WB.c \
./../opus/silk/tables_other.c \
./../opus/silk/tables_pitch_lag.c \
./../opus/silk/tables_pulses_per_block.c \
./../opus/silk/VAD.c \
./../opus/silk/control_audio_bandwidth.c \
./../opus/silk/quant_LTP_gains.c \
./../opus/silk/VQ_WMat_EC.c \
./../opus/silk/HP_variable_cutoff.c \
./../opus/silk/NLSF_encode.c \
./../opus/silk/NLSF_VQ.c \
./../opus/silk/NLSF_unpack.c \
./../opus/silk/NLSF_del_dec_quant.c \
./../opus/silk/process_NLSFs.c \
./../opus/silk/stereo_LR_to_MS.c \
./../opus/silk/stereo_MS_to_LR.c \
./../opus/silk/check_control_input.c \
./../opus/silk/control_SNR.c \
./../opus/silk/init_encoder.c \
./../opus/silk/control_codec.c \
./../opus/silk/A2NLSF.c \
./../opus/silk/ana_filt_bank_1.c \
./../opus/silk/biquad_alt.c \
./../opus/silk/bwexpander_32.c \
./../opus/silk/bwexpander.c \
./../opus/silk/debug.c \
./../opus/silk/decode_pitch.c \
./../opus/silk/inner_prod_aligned.c \
./../opus/silk/lin2log.c \
./../opus/silk/log2lin.c \
./../opus/silk/LPC_analysis_filter.c \
./../opus/silk/LPC_inv_pred_gain.c \
./../opus/silk/table_LSF_cos.c \
./../opus/silk/NLSF2A.c \
./../opus/silk/NLSF_stabilize.c \
./../opus/silk/NLSF_VQ_weights_laroia.c \
./../opus/silk/pitch_est_tables.c \
./../opus/silk/resampler.c \
./../opus/silk/resampler_down2_3.c \
./../opus/silk/resampler_down2.c \
./../opus/silk/resampler_private_AR2.c \
./../opus/silk/resampler_private_down_FIR.c \
./../opus/silk/resampler_private_IIR_FIR.c \
./../opus/silk/resampler_private_up2_HQ.c \
./../opus/silk/resampler_rom.c \
./../opus/silk/sigm_Q15.c \
./../opus/silk/sort.c \
./../opus/silk/sum_sqr_shift.c \
./../opus/silk/stereo_decode_pred.c \
./../opus/silk/stereo_encode_pred.c \
./../opus/silk/stereo_find_predictor.c \
./../opus/silk/stereo_quant_pred.c \
./../opus/silk/LPC_fit.c
LOCAL_SRC_FILES += \
./../opus/silk/fixed/LTP_analysis_filter_FIX.c \
./../opus/silk/fixed/LTP_scale_ctrl_FIX.c \
./../opus/silk/fixed/corrMatrix_FIX.c \
./../opus/silk/fixed/encode_frame_FIX.c \
./../opus/silk/fixed/find_LPC_FIX.c \
./../opus/silk/fixed/find_LTP_FIX.c \
./../opus/silk/fixed/find_pitch_lags_FIX.c \
./../opus/silk/fixed/find_pred_coefs_FIX.c \
./../opus/silk/fixed/noise_shape_analysis_FIX.c \
./../opus/silk/fixed/process_gains_FIX.c \
./../opus/silk/fixed/regularize_correlations_FIX.c \
./../opus/silk/fixed/residual_energy16_FIX.c \
./../opus/silk/fixed/residual_energy_FIX.c \
./../opus/silk/fixed/warped_autocorrelation_FIX.c \
./../opus/silk/fixed/apply_sine_window_FIX.c \
./../opus/silk/fixed/autocorr_FIX.c \
./../opus/silk/fixed/burg_modified_FIX.c \
./../opus/silk/fixed/k2a_FIX.c \
./../opus/silk/fixed/k2a_Q16_FIX.c \
./../opus/silk/fixed/pitch_analysis_core_FIX.c \
./../opus/silk/fixed/vector_ops_FIX.c \
./../opus/silk/fixed/schur64_FIX.c \
./../opus/silk/fixed/schur_FIX.c
LOCAL_SRC_FILES += \
./../opus/celt/bands.c \
./../opus/celt/celt.c \
./../opus/celt/celt_encoder.c \
./../opus/celt/celt_decoder.c \
./../opus/celt/cwrs.c \
./../opus/celt/entcode.c \
./../opus/celt/entdec.c \
./../opus/celt/entenc.c \
./../opus/celt/kiss_fft.c \
./../opus/celt/laplace.c \
./../opus/celt/mathops.c \
./../opus/celt/mdct.c \
./../opus/celt/modes.c \
./../opus/celt/pitch.c \
./../opus/celt/celt_lpc.c \
./../opus/celt/quant_bands.c \
./../opus/celt/rate.c \
./../opus/celt/vq.c \
./../opus/celt/arm/armcpu.c \
./../opus/celt/arm/arm_celt_map.c
LOCAL_SRC_FILES += \
./../opus/ogg/bitwise.c \
./../opus/ogg/framing.c \
./../opus/opusfile/info.c \
./../opus/opusfile/internal.c \
./../opus/opusfile/opusfile.c \
./../opus/opusfile/stream.c
include $(BUILD_SHARED_LIBRARY)

View File

@ -5,8 +5,8 @@
//
#ifndef TGVOIP_NO_DSP
#include "webrtc_dsp/modules/audio_processing/include/audio_processing.h"
#include "webrtc_dsp/api/audio/audio_frame.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "api/audio/audio_frame.h"
#endif
#include "EchoCanceller.h"
@ -28,9 +28,6 @@ EchoCanceller::EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC){
isOn=true;
webrtc::Config extraConfig;
#ifdef TGVOIP_USE_DESKTOP_DSP
extraConfig.Set(new webrtc::DelayAgnostic(true));
#endif
apm=webrtc::AudioProcessingBuilder().Create(extraConfig);
@ -43,199 +40,217 @@ EchoCanceller::EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC){
#endif
config.high_pass_filter.enabled = enableAEC;
config.gain_controller2.enabled = enableAGC;
apm->ApplyConfig(config);
webrtc::NoiseSuppression::Level nsLevel;
using Level = webrtc::AudioProcessing::Config::NoiseSuppression::Level;
Level nsLevel;
#ifdef __APPLE__
switch(ServerConfig::GetSharedInstance()->GetInt("webrtc_ns_level_vpio", 0)){
#else
switch(ServerConfig::GetSharedInstance()->GetInt("webrtc_ns_level", 2)){
switch (ServerConfig::GetSharedInstance()->GetInt("webrtc_ns_level", 2)) {
#endif
case 0:
nsLevel=webrtc::NoiseSuppression::Level::kLow;
break;
case 1:
nsLevel=webrtc::NoiseSuppression::Level::kModerate;
break;
case 3:
nsLevel=webrtc::NoiseSuppression::Level::kVeryHigh;
break;
case 2:
default:
nsLevel=webrtc::NoiseSuppression::Level::kHigh;
break;
}
apm->noise_suppression()->set_level(nsLevel);
apm->noise_suppression()->Enable(enableNS);
if(enableAGC){
apm->gain_control()->set_mode(webrtc::GainControl::Mode::kAdaptiveDigital);
apm->gain_control()->set_target_level_dbfs(ServerConfig::GetSharedInstance()->GetInt("webrtc_agc_target_level", 9));
apm->gain_control()->enable_limiter(ServerConfig::GetSharedInstance()->GetBoolean("webrtc_agc_enable_limiter", true));
apm->gain_control()->set_compression_gain_db(ServerConfig::GetSharedInstance()->GetInt("webrtc_agc_compression_gain", 20));
}
apm->voice_detection()->set_likelihood(webrtc::VoiceDetection::Likelihood::kVeryLowLikelihood);
case 0:
nsLevel=Level::kLow;
break;
case 1:
nsLevel=Level::kModerate;
break;
case 3:
nsLevel=Level::kVeryHigh;
break;
case 2:
default:
nsLevel=Level::kHigh;
break;
}
config.noise_suppression.level = nsLevel;
config.noise_suppression.enabled = enableNS;
if (enableAGC) {
config.gain_controller1.mode = webrtc::AudioProcessing::Config::GainController1::kAdaptiveDigital;
config.gain_controller1.target_level_dbfs = ServerConfig::GetSharedInstance()->GetInt("webrtc_agc_target_level", 9);
config.gain_controller1.enable_limiter = ServerConfig::GetSharedInstance()->GetBoolean("webrtc_agc_enable_limiter", true);
config.gain_controller1.compression_gain_db = ServerConfig::GetSharedInstance()->GetInt("webrtc_agc_compression_gain", 20);
}
config.voice_detection.enabled = true;
audioFrame=new webrtc::AudioFrame();
audioFrame->samples_per_channel_=480;
audioFrame->sample_rate_hz_=48000;
audioFrame->num_channels_=1;
apm->ApplyConfig(config);
farendQueue=new BlockingQueue<int16_t*>(11);
farendBufferPool=new BufferPool(960*2, 10);
running=true;
bufferFarendThread=new Thread(std::bind(&EchoCanceller::RunBufferFarendThread, this));
bufferFarendThread->Start();
audioFrame = new webrtc::AudioFrame();
audioFrame->samples_per_channel_ = 480;
audioFrame->sample_rate_hz_ = 48000;
audioFrame->num_channels_ = 1;
farendQueue = new BlockingQueue<int16_t *>(11);
farendBufferPool = new BufferPool(960 * 2, 10);
running = true;
bufferFarendThread = new Thread(std::bind(&EchoCanceller::RunBufferFarendThread, this));
bufferFarendThread->Start();
#else
this->enableAEC=this->enableAGC=enableAGC=this->enableNS=enableNS=false;
isOn=true;
this->enableAEC=this->enableAGC=enableAGC=this->enableNS=enableNS=false;
isOn=true;
#endif
}
EchoCanceller::~EchoCanceller(){
EchoCanceller::~EchoCanceller() {
#ifndef TGVOIP_NO_DSP
delete apm;
delete audioFrame;
delete farendBufferPool;
delete apm;
delete audioFrame;
delete farendBufferPool;
#endif
}
void EchoCanceller::Start(){
void EchoCanceller::Start() {
}
void EchoCanceller::Stop(){
void EchoCanceller::Stop() {
}
void EchoCanceller::SpeakerOutCallback(unsigned char* data, size_t len){
if(len!=960*2 || !enableAEC || !isOn)
return;
void EchoCanceller::SpeakerOutCallback(unsigned char* data, size_t len) {
if (len != 960 * 2 || !enableAEC || !isOn)
return;
#ifndef TGVOIP_NO_DSP
int16_t* buf=(int16_t*)farendBufferPool->Get();
if(buf){
memcpy(buf, data, 960*2);
farendQueue->Put(buf);
}
int16_t *buf = (int16_t *) farendBufferPool->Get();
if (buf) {
memcpy(buf, data, 960 * 2);
farendQueue->Put(buf);
}
#endif
}
#ifndef TGVOIP_NO_DSP
void EchoCanceller::RunBufferFarendThread(){
webrtc::AudioFrame frame;
frame.num_channels_=1;
frame.sample_rate_hz_=48000;
frame.samples_per_channel_=480;
while(running){
int16_t* samplesIn=farendQueue->GetBlocking();
if(samplesIn){
memcpy(frame.mutable_data(), samplesIn, 480*2);
apm->ProcessReverseStream(&frame);
memcpy(frame.mutable_data(), samplesIn+480, 480*2);
apm->ProcessReverseStream(&frame);
didBufferFarend=true;
farendBufferPool->Reuse(reinterpret_cast<unsigned char*>(samplesIn));
}
}
void EchoCanceller::RunBufferFarendThread() {
webrtc::AudioFrame frame;
frame.num_channels_ = 1;
frame.sample_rate_hz_ = 48000;
frame.samples_per_channel_ = 480;
webrtc::StreamConfig input_config(frame.sample_rate_hz_, frame.num_channels_,
/*has_keyboard=*/false);
webrtc::StreamConfig output_config(frame.sample_rate_hz_, frame.num_channels_,
/*has_keyboard=*/false);
while (running) {
int16_t *samplesIn = farendQueue->GetBlocking();
if (samplesIn) {
memcpy(frame.mutable_data(), samplesIn, 480 * 2);
apm->ProcessReverseStream(frame.data(), input_config,
output_config, frame.mutable_data());
memcpy(frame.mutable_data(), samplesIn + 480, 480 * 2);
apm->ProcessReverseStream(frame.data(), input_config,
output_config, frame.mutable_data());
didBufferFarend = true;
farendBufferPool->Reuse(reinterpret_cast<unsigned char *>(samplesIn));
}
}
}
#endif
void EchoCanceller::Enable(bool enabled){
isOn=enabled;
void EchoCanceller::Enable(bool enabled) {
isOn = enabled;
}
void EchoCanceller::ProcessInput(int16_t* inOut, size_t numSamples, bool& hasVoice){
void EchoCanceller::ProcessInput(int16_t* inOut, size_t numSamples, bool& hasVoice) {
#ifndef TGVOIP_NO_DSP
if(!isOn || (!enableAEC && !enableAGC && !enableNS)){
return;
}
int delay=audio::AudioInput::GetEstimatedDelay()+audio::AudioOutput::GetEstimatedDelay();
assert(numSamples==960);
if (!isOn || (!enableAEC && !enableAGC && !enableNS)) {
return;
}
int delay = audio::AudioInput::GetEstimatedDelay() + audio::AudioOutput::GetEstimatedDelay();
assert(numSamples == 960);
memcpy(audioFrame->mutable_data(), inOut, 480*2);
if(enableAEC)
apm->set_stream_delay_ms(delay);
apm->ProcessStream(audioFrame);
if(enableVAD)
hasVoice=apm->voice_detection()->stream_has_voice();
memcpy(inOut, audioFrame->data(), 480*2);
memcpy(audioFrame->mutable_data(), inOut+480, 480*2);
if(enableAEC)
apm->set_stream_delay_ms(delay);
apm->ProcessStream(audioFrame);
if(enableVAD){
hasVoice=hasVoice || apm->voice_detection()->stream_has_voice();
}
memcpy(inOut+480, audioFrame->data(), 480*2);
webrtc::StreamConfig input_config(audioFrame->sample_rate_hz_, audioFrame->num_channels_,
/*has_keyboard=*/false);
webrtc::StreamConfig output_config(audioFrame->sample_rate_hz_, audioFrame->num_channels_,
/*has_keyboard=*/false);
memcpy(audioFrame->mutable_data(), inOut, 480 * 2);
if (enableAEC)
apm->set_stream_delay_ms(delay);
apm->ProcessStream(audioFrame->data(), input_config,
output_config, audioFrame->mutable_data());
if (enableVAD)
hasVoice= apm->GetStatistics().voice_detected.value_or(false);
memcpy(inOut, audioFrame->data(), 480 * 2);
memcpy(audioFrame->mutable_data(), inOut + 480, 480 * 2);
if (enableAEC)
apm->set_stream_delay_ms(delay);
apm->ProcessStream(audioFrame->data(), input_config,
output_config, audioFrame->mutable_data());
if (enableVAD) {
hasVoice=hasVoice || apm->GetStatistics().voice_detected.value_or(false);
}
memcpy(inOut + 480, audioFrame->data(), 480 * 2);
#endif
}
void EchoCanceller::SetAECStrength(int strength){
void EchoCanceller::SetAECStrength(int strength) {
#ifndef TGVOIP_NO_DSP
/*if(aec){
/*if(aec){
#ifndef TGVOIP_USE_DESKTOP_DSP
AecmConfig cfg;
cfg.cngMode=AecmFalse;
cfg.echoMode=(int16_t) strength;
WebRtcAecm_set_config(aec, cfg);
AecmConfig cfg;
cfg.cngMode=AecmFalse;
cfg.echoMode=(int16_t) strength;
WebRtcAecm_set_config(aec, cfg);
#endif
}*/
}*/
#endif
}
void EchoCanceller::SetVoiceDetectionEnabled(bool enabled){
enableVAD=enabled;
void EchoCanceller::SetVoiceDetectionEnabled(bool enabled) {
enableVAD = enabled;
#ifndef TGVOIP_NO_DSP
apm->voice_detection()->Enable(enabled);
auto config = apm->GetConfig();
config.voice_detection.enabled = enabled;
apm->ApplyConfig(config);
#endif
}
using namespace tgvoip::effects;
AudioEffect::~AudioEffect(){
AudioEffect::~AudioEffect() {
}
void AudioEffect::SetPassThrough(bool passThrough){
this->passThrough=passThrough;
void AudioEffect::SetPassThrough(bool passThrough) {
this->passThrough = passThrough;
}
Volume::Volume(){
Volume::Volume() {
}
Volume::~Volume(){
Volume::~Volume() {
}
void Volume::Process(int16_t* inOut, size_t numSamples){
if(level==1.0f || passThrough){
return;
}
for(size_t i=0;i<numSamples;i++){
float sample=(float)inOut[i]*multiplier;
if(sample>32767.0f)
inOut[i]=INT16_MAX;
else if(sample<-32768.0f)
inOut[i]=INT16_MIN;
else
inOut[i]=(int16_t)sample;
}
void Volume::Process(int16_t* inOut, size_t numSamples) {
if (level == 1.0f || passThrough) {
return;
}
for (size_t i = 0; i < numSamples; i++) {
float sample = (float) inOut[i] * multiplier;
if (sample > 32767.0f)
inOut[i] = INT16_MAX;
else if (sample < -32768.0f)
inOut[i] = INT16_MIN;
else
inOut[i] = (int16_t) sample;
}
}
void Volume::SetLevel(float level){
this->level=level;
float db;
if(level<1.0f)
db=-50.0f*(1.0f-level);
else if(level>1.0f && level<=2.0f)
db=10.0f*(level-1.0f);
else
db=0.0f;
multiplier=expf(db/20.0f * logf(10.0f));
void Volume::SetLevel(float level) {
this->level = level;
float db;
if (level < 1.0f)
db = -50.0f * (1.0f - level);
else if (level > 1.0f && level <= 2.0f)
db = 10.0f * (level - 1.0f);
else
db = 0.0f;
multiplier = expf(db / 20.0f * logf(10.0f));
}
float Volume::GetLevel(){
return level;
float Volume::GetLevel() {
return level;
}

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,762 +0,0 @@
AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall -DHAVE_CONFIG_H -Wno-unknown-pragmas
lib_LTLIBRARIES = libtgvoip.la
SRC = TgVoip.cpp \
VoIPController.cpp \
Buffers.cpp \
CongestionControl.cpp \
EchoCanceller.cpp \
JitterBuffer.cpp \
logging.cpp \
MediaStreamItf.cpp \
MessageThread.cpp \
NetworkSocket.cpp \
OpusDecoder.cpp \
OpusEncoder.cpp \
PacketReassembler.cpp \
VoIPGroupController.cpp \
VoIPServerConfig.cpp \
audio/AudioIO.cpp \
audio/AudioInput.cpp \
audio/AudioOutput.cpp \
audio/Resampler.cpp \
os/posix/NetworkSocketPosix.cpp \
video/VideoSource.cpp \
video/VideoRenderer.cpp \
video/ScreamCongestionController.cpp \
json11.cpp
TGVOIP_HDRS = \
TgVoip.h \
VoIPController.h \
Buffers.h \
BlockingQueue.h \
PrivateDefines.h \
CongestionControl.h \
EchoCanceller.h \
JitterBuffer.h \
logging.h \
threading.h \
MediaStreamItf.h \
MessageThread.h \
NetworkSocket.h \
OpusDecoder.h \
OpusEncoder.h \
PacketReassembler.h \
VoIPServerConfig.h \
audio/AudioIO.h \
audio/AudioInput.h \
audio/AudioOutput.h \
audio/Resampler.h \
os/posix/NetworkSocketPosix.h \
video/VideoSource.h \
video/VideoRenderer.h \
video/ScreamCongestionController.h \
json11.hpp \
utils.h
if TARGET_OS_OSX
SRC += \
os/darwin/AudioInputAudioUnit.cpp \
os/darwin/AudioOutputAudioUnit.cpp \
os/darwin/AudioUnitIO.cpp \
os/darwin/AudioInputAudioUnitOSX.cpp \
os/darwin/AudioOutputAudioUnitOSX.cpp \
os/darwin/DarwinSpecific.mm \
os/darwin/SampleBufferDisplayLayerRenderer.mm \
os/darwin/TGVVideoRenderer.mm \
os/darwin/TGVVideoSource.mm \
os/darwin/VideoToolboxEncoderSource.mm
TGVOIP_HDRS += \
os/darwin/AudioInputAudioUnit.h \
os/darwin/AudioOutputAudioUnit.h \
os/darwin/AudioUnitIO.h \
os/darwin/AudioInputAudioUnitOSX.h \
os/darwin/AudioOutputAudioUnitOSX.h \
os/darwin/DarwinSpecific.h \
os/darwin/SampleBufferDisplayLayerRenderer.h \
os/darwin/TGVVideoRenderer.h \
os/darwin/TGVVideoSource.h \
os/darwin/VideoToolboxEncoderSource.h
LDFLAGS += -framework Foundation -framework CoreFoundation -framework CoreAudio -framework AudioToolbox -framework VideoToolbox -framework CoreMedia -framework CoreVideo
else
# Linux-specific
if WITH_ALSA
SRC += \
os/linux/AudioInputALSA.cpp \
os/linux/AudioOutputALSA.cpp
TGVOIP_HDRS += \
os/linux/AudioInputALSA.h \
os/linux/AudioOutputALSA.h
endif
if WITH_PULSE
SRC += \
os/linux/AudioOutputPulse.cpp \
os/linux/AudioInputPulse.cpp \
os/linux/AudioPulse.cpp
TGVOIP_HDRS += \
os/linux/AudioOutputPulse.h \
os/linux/AudioInputPulse.h \
os/linux/AudioPulse.h \
os/linux/PulseFunctions.h
endif
endif
if ENABLE_DSP
CFLAGS += -DWEBRTC_POSIX -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_NS_FLOAT -I$(top_srcdir)/webrtc_dsp
CCASFLAGS += -I$(top_srcdir)/webrtc_dsp
SRC += \
./webrtc_dsp/system_wrappers/source/field_trial.cc \
./webrtc_dsp/system_wrappers/source/metrics.cc \
./webrtc_dsp/system_wrappers/source/cpu_features.cc \
./webrtc_dsp/absl/strings/internal/memutil.cc \
./webrtc_dsp/absl/strings/string_view.cc \
./webrtc_dsp/absl/strings/ascii.cc \
./webrtc_dsp/absl/types/bad_optional_access.cc \
./webrtc_dsp/absl/types/optional.cc \
./webrtc_dsp/absl/base/internal/raw_logging.cc \
./webrtc_dsp/absl/base/internal/throw_delegate.cc \
./webrtc_dsp/rtc_base/race_checker.cc \
./webrtc_dsp/rtc_base/strings/string_builder.cc \
./webrtc_dsp/rtc_base/memory/aligned_malloc.cc \
./webrtc_dsp/rtc_base/timeutils.cc \
./webrtc_dsp/rtc_base/platform_file.cc \
./webrtc_dsp/rtc_base/string_to_number.cc \
./webrtc_dsp/rtc_base/thread_checker_impl.cc \
./webrtc_dsp/rtc_base/stringencode.cc \
./webrtc_dsp/rtc_base/stringutils.cc \
./webrtc_dsp/rtc_base/checks.cc \
./webrtc_dsp/rtc_base/platform_thread.cc \
./webrtc_dsp/rtc_base/logging_webrtc.cc \
./webrtc_dsp/rtc_base/criticalsection.cc \
./webrtc_dsp/rtc_base/platform_thread_types.cc \
./webrtc_dsp/rtc_base/event.cc \
./webrtc_dsp/rtc_base/event_tracer.cc \
./webrtc_dsp/third_party/rnnoise/src/rnn_vad_weights.cc \
./webrtc_dsp/third_party/rnnoise/src/kiss_fft.cc \
./webrtc_dsp/api/audio/audio_frame.cc \
./webrtc_dsp/api/audio/echo_canceller3_config.cc \
./webrtc_dsp/api/audio/echo_canceller3_factory.cc \
./webrtc_dsp/modules/third_party/fft/fft.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filterbanks.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/transform.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_filter.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filter_functions.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lattice.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/intialize.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/entropy_coding.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_vad.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/crc.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode_bwe.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c \
./webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac.c \
./webrtc_dsp/modules/audio_processing/rms_level.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/normalized_covariance_estimator.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/moving_max.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/circular_buffer.cc \
./webrtc_dsp/modules/audio_processing/echo_detector/mean_variance_estimator.cc \
./webrtc_dsp/modules/audio_processing/splitting_filter.cc \
./webrtc_dsp/modules/audio_processing/gain_control_impl.cc \
./webrtc_dsp/modules/audio_processing/ns/nsx_core.c \
./webrtc_dsp/modules/audio_processing/ns/noise_suppression_x.c \
./webrtc_dsp/modules/audio_processing/ns/nsx_core_c.c \
./webrtc_dsp/modules/audio_processing/ns/ns_core.c \
./webrtc_dsp/modules/audio_processing/ns/noise_suppression.c \
./webrtc_dsp/modules/audio_processing/audio_buffer.cc \
./webrtc_dsp/modules/audio_processing/typing_detection.cc \
./webrtc_dsp/modules/audio_processing/include/audio_processing_statistics.cc \
./webrtc_dsp/modules/audio_processing/include/audio_generator_factory.cc \
./webrtc_dsp/modules/audio_processing/include/aec_dump.cc \
./webrtc_dsp/modules/audio_processing/include/audio_processing.cc \
./webrtc_dsp/modules/audio_processing/include/config.cc \
./webrtc_dsp/modules/audio_processing/agc2/interpolated_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/agc2_common.cc \
./webrtc_dsp/modules/audio_processing/agc2/gain_applier.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_agc.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_digital_gain_applier.cc \
./webrtc_dsp/modules/audio_processing/agc2/limiter.cc \
./webrtc_dsp/modules/audio_processing/agc2/saturation_protector.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/rnn.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search_internal.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/features_extraction.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/fft_util.cc \
./webrtc_dsp/modules/audio_processing/agc2/rnn_vad/lp_residual.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.cc \
./webrtc_dsp/modules/audio_processing/agc2/vector_float_frame.cc \
./webrtc_dsp/modules/audio_processing/agc2/noise_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/agc2_testing_common.cc \
./webrtc_dsp/modules/audio_processing/agc2/fixed_digital_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/fixed_gain_controller.cc \
./webrtc_dsp/modules/audio_processing/agc2/vad_with_level.cc \
./webrtc_dsp/modules/audio_processing/agc2/limiter_db_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/down_sampler.cc \
./webrtc_dsp/modules/audio_processing/agc2/signal_classifier.cc \
./webrtc_dsp/modules/audio_processing/agc2/noise_spectrum_estimator.cc \
./webrtc_dsp/modules/audio_processing/agc2/compute_interpolated_gain_curve.cc \
./webrtc_dsp/modules/audio_processing/agc2/biquad_filter.cc \
./webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc \
./webrtc_dsp/modules/audio_processing/transient/moving_moments.cc \
./webrtc_dsp/modules/audio_processing/transient/wpd_tree.cc \
./webrtc_dsp/modules/audio_processing/transient/wpd_node.cc \
./webrtc_dsp/modules/audio_processing/transient/transient_suppressor.cc \
./webrtc_dsp/modules/audio_processing/transient/transient_detector.cc \
./webrtc_dsp/modules/audio_processing/low_cut_filter.cc \
./webrtc_dsp/modules/audio_processing/level_estimator_impl.cc \
./webrtc_dsp/modules/audio_processing/three_band_filter_bank.cc \
./webrtc_dsp/modules/audio_processing/aec/echo_cancellation.cc \
./webrtc_dsp/modules/audio_processing/aec/aec_resampler.cc \
./webrtc_dsp/modules/audio_processing/aec/aec_core.cc \
./webrtc_dsp/modules/audio_processing/voice_detection_impl.cc \
./webrtc_dsp/modules/audio_processing/echo_cancellation_impl.cc \
./webrtc_dsp/modules/audio_processing/gain_control_for_experimental_agc.cc \
./webrtc_dsp/modules/audio_processing/agc/agc.cc \
./webrtc_dsp/modules/audio_processing/agc/loudness_histogram.cc \
./webrtc_dsp/modules/audio_processing/agc/agc_manager_direct.cc \
./webrtc_dsp/modules/audio_processing/agc/legacy/analog_agc.c \
./webrtc_dsp/modules/audio_processing/agc/legacy/digital_agc.c \
./webrtc_dsp/modules/audio_processing/agc/utility.cc \
./webrtc_dsp/modules/audio_processing/audio_processing_impl.cc \
./webrtc_dsp/modules/audio_processing/audio_generator/file_audio_generator.cc \
./webrtc_dsp/modules/audio_processing/gain_controller2.cc \
./webrtc_dsp/modules/audio_processing/residual_echo_detector.cc \
./webrtc_dsp/modules/audio_processing/noise_suppression_impl.cc \
./webrtc_dsp/modules/audio_processing/aecm/aecm_core.cc \
./webrtc_dsp/modules/audio_processing/aecm/aecm_core_c.cc \
./webrtc_dsp/modules/audio_processing/aecm/echo_control_mobile.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_reverb_model.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model_fallback.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_remover_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer2.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_path_variability.cc \
./webrtc_dsp/modules/audio_processing/aec3/frame_blocker.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec3_fft.cc \
./webrtc_dsp/modules/audio_processing/aec3/fullband_erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_filter.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_processor.cc \
./webrtc_dsp/modules/audio_processing/aec3/subband_erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/vector_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/erl_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec_state.cc \
./webrtc_dsp/modules/audio_processing/aec3/adaptive_fir_filter.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller.cc \
./webrtc_dsp/modules/audio_processing/aec3/skew_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_path_delay_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_framer.cc \
./webrtc_dsp/modules/audio_processing/aec3/erle_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model.cc \
./webrtc_dsp/modules/audio_processing/aec3/cascaded_biquad_filter.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor_output.cc \
./webrtc_dsp/modules/audio_processing/aec3/stationarity_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_signal_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/subtractor_output_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_gain.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_audibility.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_processor_metrics.cc \
./webrtc_dsp/modules/audio_processing/aec3/moving_average.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_model_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/aec3_common.cc \
./webrtc_dsp/modules/audio_processing/aec3/residual_echo_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/matched_filter.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_decay_estimator.cc \
./webrtc_dsp/modules/audio_processing/aec3/render_delay_controller2.cc \
./webrtc_dsp/modules/audio_processing/aec3/suppression_gain_limiter.cc \
./webrtc_dsp/modules/audio_processing/aec3/main_filter_update_gain.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_remover.cc \
./webrtc_dsp/modules/audio_processing/aec3/downsampled_render_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/matrix_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_processor2.cc \
./webrtc_dsp/modules/audio_processing/aec3/echo_canceller3.cc \
./webrtc_dsp/modules/audio_processing/aec3/block_delay_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/fft_buffer.cc \
./webrtc_dsp/modules/audio_processing/aec3/comfort_noise_generator.cc \
./webrtc_dsp/modules/audio_processing/aec3/shadow_filter_update_gain.cc \
./webrtc_dsp/modules/audio_processing/aec3/filter_analyzer.cc \
./webrtc_dsp/modules/audio_processing/aec3/reverb_frequency_response.cc \
./webrtc_dsp/modules/audio_processing/aec3/decimator.cc \
./webrtc_dsp/modules/audio_processing/echo_control_mobile_impl.cc \
./webrtc_dsp/modules/audio_processing/logging/apm_data_dumper.cc \
./webrtc_dsp/modules/audio_processing/vad/voice_activity_detector.cc \
./webrtc_dsp/modules/audio_processing/vad/standalone_vad.cc \
./webrtc_dsp/modules/audio_processing/vad/pitch_internal.cc \
./webrtc_dsp/modules/audio_processing/vad/vad_circular_buffer.cc \
./webrtc_dsp/modules/audio_processing/vad/vad_audio_proc.cc \
./webrtc_dsp/modules/audio_processing/vad/pole_zero_filter.cc \
./webrtc_dsp/modules/audio_processing/vad/pitch_based_vad.cc \
./webrtc_dsp/modules/audio_processing/vad/gmm.cc \
./webrtc_dsp/modules/audio_processing/utility/ooura_fft.cc \
./webrtc_dsp/modules/audio_processing/utility/delay_estimator_wrapper.cc \
./webrtc_dsp/modules/audio_processing/utility/delay_estimator.cc \
./webrtc_dsp/modules/audio_processing/utility/block_mean_calculator.cc \
./webrtc_dsp/common_audio/window_generator.cc \
./webrtc_dsp/common_audio/channel_buffer.cc \
./webrtc_dsp/common_audio/fir_filter_factory.cc \
./webrtc_dsp/common_audio/wav_header.cc \
./webrtc_dsp/common_audio/real_fourier_ooura.cc \
./webrtc_dsp/common_audio/audio_util.cc \
./webrtc_dsp/common_audio/fir_filter_sse.cc \
./webrtc_dsp/common_audio/resampler/push_sinc_resampler.cc \
./webrtc_dsp/common_audio/resampler/resampler.cc \
./webrtc_dsp/common_audio/resampler/sinc_resampler_sse.cc \
./webrtc_dsp/common_audio/resampler/push_resampler.cc \
./webrtc_dsp/common_audio/resampler/sinc_resampler.cc \
./webrtc_dsp/common_audio/resampler/sinusoidal_linear_chirp_source.cc \
./webrtc_dsp/common_audio/wav_file.cc \
./webrtc_dsp/common_audio/third_party/fft4g/fft4g.c \
./webrtc_dsp/common_audio/audio_converter.cc \
./webrtc_dsp/common_audio/real_fourier.cc \
./webrtc_dsp/common_audio/sparse_fir_filter.cc \
./webrtc_dsp/common_audio/smoothing_filter.cc \
./webrtc_dsp/common_audio/fir_filter_c.cc \
./webrtc_dsp/common_audio/ring_buffer.c \
./webrtc_dsp/common_audio/signal_processing/complex_fft.c \
./webrtc_dsp/common_audio/signal_processing/filter_ma_fast_q12.c \
./webrtc_dsp/common_audio/signal_processing/splitting_filter1.c \
./webrtc_dsp/common_audio/signal_processing/levinson_durbin.c \
./webrtc_dsp/common_audio/signal_processing/dot_product_with_scale.cc \
./webrtc_dsp/common_audio/signal_processing/auto_corr_to_refl_coef.c \
./webrtc_dsp/common_audio/signal_processing/resample_by_2_internal.c \
./webrtc_dsp/common_audio/signal_processing/energy.c \
./webrtc_dsp/common_audio/signal_processing/sqrt_of_one_minus_x_squared.c \
./webrtc_dsp/common_audio/signal_processing/downsample_fast.c \
./webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12.c \
./webrtc_dsp/common_audio/signal_processing/spl_init.c \
./webrtc_dsp/common_audio/signal_processing/lpc_to_refl_coef.c \
./webrtc_dsp/common_audio/signal_processing/cross_correlation.c \
./webrtc_dsp/common_audio/signal_processing/division_operations.c \
./webrtc_dsp/common_audio/signal_processing/auto_correlation.c \
./webrtc_dsp/common_audio/signal_processing/get_scaling_square.c \
./webrtc_dsp/common_audio/signal_processing/resample.c \
./webrtc_dsp/common_audio/signal_processing/min_max_operations.c \
./webrtc_dsp/common_audio/signal_processing/refl_coef_to_lpc.c \
./webrtc_dsp/common_audio/signal_processing/filter_ar.c \
./webrtc_dsp/common_audio/signal_processing/vector_scaling_operations.c \
./webrtc_dsp/common_audio/signal_processing/resample_fractional.c \
./webrtc_dsp/common_audio/signal_processing/real_fft.c \
./webrtc_dsp/common_audio/signal_processing/ilbc_specific_functions.c \
./webrtc_dsp/common_audio/signal_processing/randomization_functions.c \
./webrtc_dsp/common_audio/signal_processing/copy_set_operations.c \
./webrtc_dsp/common_audio/signal_processing/resample_by_2.c \
./webrtc_dsp/common_audio/signal_processing/get_hanning_window.c \
./webrtc_dsp/common_audio/signal_processing/resample_48khz.c \
./webrtc_dsp/common_audio/signal_processing/spl_inl.c \
./webrtc_dsp/common_audio/signal_processing/spl_sqrt.c \
./webrtc_dsp/common_audio/vad/vad_sp.c \
./webrtc_dsp/common_audio/vad/vad.cc \
./webrtc_dsp/common_audio/vad/webrtc_vad.c \
./webrtc_dsp/common_audio/vad/vad_filterbank.c \
./webrtc_dsp/common_audio/vad/vad_core.c \
./webrtc_dsp/common_audio/vad/vad_gmm.c
if TARGET_OS_OSX
CFLAGS += -DWEBRTC_MAC
SRC += \
webrtc_dsp/rtc_base/logging_mac.mm \
webrtc_dsp/rtc_base/logging_mac.h
else
CFLAGS += -DWEBRTC_LINUX
endif
if TARGET_CPU_X86
SRC += \
webrtc_dsp/modules/audio_processing/aec/aec_core_sse2.cc \
webrtc_dsp/modules/audio_processing/utility/ooura_fft_sse2.cc
endif
if ENABLE_AUDIO_CALLBACK
CFLAGS += -DTGVOIP_USE_CALLBACK_AUDIO_IO
SRC += \
audio/AudioIOCallback.cpp
TGVOIP_HDRS += \
audio/AudioIOCallback.h
endif
if TARGET_CPU_ARM
SRC += \
webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S \
webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S
if TARGET_CPU_ARMV7
CFLAGS += -mfpu=neon -mfloat-abi=hard
CCASFLAGS += -mfpu=neon -mfloat-abi=hard
SRC += \
webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.c \
webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.c \
webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.c \
webrtc_dsp/modules/audio_processing/aec/aec_core_neon.cc \
webrtc_dsp/modules/audio_processing/aecm/aecm_core_neon.cc \
webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.c \
webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc
# webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S
endif
else
SRC += \
webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c \
webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c
endif
# headers
SRC += \
webrtc_dsp/system_wrappers/include/field_trial.h \
webrtc_dsp/system_wrappers/include/cpu_features_wrapper.h \
webrtc_dsp/system_wrappers/include/asm_defines.h \
webrtc_dsp/system_wrappers/include/metrics.h \
webrtc_dsp/system_wrappers/include/compile_assert_c.h \
webrtc_dsp/typedefs.h \
webrtc_dsp/absl/strings/internal/memutil.h \
webrtc_dsp/absl/strings/ascii.h \
webrtc_dsp/absl/strings/string_view.h \
webrtc_dsp/absl/types/optional.h \
webrtc_dsp/absl/types/bad_optional_access.h \
webrtc_dsp/absl/memory/memory.h \
webrtc_dsp/absl/meta/type_traits.h \
webrtc_dsp/absl/algorithm/algorithm.h \
webrtc_dsp/absl/container/inlined_vector.h \
webrtc_dsp/absl/base/policy_checks.h \
webrtc_dsp/absl/base/port.h \
webrtc_dsp/absl/base/config.h \
webrtc_dsp/absl/base/internal/invoke.h \
webrtc_dsp/absl/base/internal/inline_variable.h \
webrtc_dsp/absl/base/internal/atomic_hook.h \
webrtc_dsp/absl/base/internal/identity.h \
webrtc_dsp/absl/base/internal/raw_logging.h \
webrtc_dsp/absl/base/internal/throw_delegate.h \
webrtc_dsp/absl/base/attributes.h \
webrtc_dsp/absl/base/macros.h \
webrtc_dsp/absl/base/optimization.h \
webrtc_dsp/absl/base/log_severity.h \
webrtc_dsp/absl/utility/utility.h \
webrtc_dsp/rtc_base/string_to_number.h \
webrtc_dsp/rtc_base/constructormagic.h \
webrtc_dsp/rtc_base/strings/string_builder.h \
webrtc_dsp/rtc_base/event_tracer.h \
webrtc_dsp/rtc_base/stringencode.h \
webrtc_dsp/rtc_base/memory/aligned_malloc.h \
webrtc_dsp/rtc_base/event.h \
webrtc_dsp/rtc_base/ignore_wundef.h \
webrtc_dsp/rtc_base/stringutils.h \
webrtc_dsp/rtc_base/arraysize.h \
webrtc_dsp/rtc_base/swap_queue.h \
webrtc_dsp/rtc_base/trace_event.h \
webrtc_dsp/rtc_base/checks.h \
webrtc_dsp/rtc_base/deprecation.h \
webrtc_dsp/rtc_base/sanitizer.h \
webrtc_dsp/rtc_base/scoped_ref_ptr.h \
webrtc_dsp/rtc_base/logging.h \
webrtc_dsp/rtc_base/timeutils.h \
webrtc_dsp/rtc_base/atomicops.h \
webrtc_dsp/rtc_base/numerics/safe_minmax.h \
webrtc_dsp/rtc_base/numerics/safe_conversions.h \
webrtc_dsp/rtc_base/numerics/safe_conversions_impl.h \
webrtc_dsp/rtc_base/numerics/safe_compare.h \
webrtc_dsp/rtc_base/system/unused.h \
webrtc_dsp/rtc_base/system/inline.h \
webrtc_dsp/rtc_base/system/ignore_warnings.h \
webrtc_dsp/rtc_base/system/asm_defines.h \
webrtc_dsp/rtc_base/system/rtc_export.h \
webrtc_dsp/rtc_base/system/arch.h \
webrtc_dsp/rtc_base/platform_thread.h \
webrtc_dsp/rtc_base/platform_thread_types.h \
webrtc_dsp/rtc_base/protobuf_utils.h \
webrtc_dsp/rtc_base/thread_annotations.h \
webrtc_dsp/rtc_base/gtest_prod_util.h \
webrtc_dsp/rtc_base/function_view.h \
webrtc_dsp/rtc_base/criticalsection.h \
webrtc_dsp/rtc_base/refcount.h \
webrtc_dsp/rtc_base/thread_checker_impl.h \
webrtc_dsp/rtc_base/compile_assert_c.h \
webrtc_dsp/rtc_base/type_traits.h \
webrtc_dsp/rtc_base/platform_file.h \
webrtc_dsp/rtc_base/refcounter.h \
webrtc_dsp/rtc_base/thread_checker.h \
webrtc_dsp/rtc_base/race_checker.h \
webrtc_dsp/rtc_base/refcountedobject.h \
webrtc_dsp/third_party/rnnoise/src/rnn_activations.h \
webrtc_dsp/third_party/rnnoise/src/kiss_fft.h \
webrtc_dsp/third_party/rnnoise/src/rnn_vad_weights.h \
webrtc_dsp/api/audio/echo_canceller3_config.h \
webrtc_dsp/api/audio/echo_control.h \
webrtc_dsp/api/audio/audio_frame.h \
webrtc_dsp/api/audio/echo_canceller3_factory.h \
webrtc_dsp/api/array_view.h \
webrtc_dsp/modules/third_party/fft/fft.h \
webrtc_dsp/modules/audio_coding/codecs/isac/bandwidth_info.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/include/isac.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/entropy_coding.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_vad.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/settings.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/crc.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_float_type.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/codec.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/structs.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filter_functions.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_filter.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h \
webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_tables.h \
webrtc_dsp/modules/audio_processing/echo_detector/moving_max.h \
webrtc_dsp/modules/audio_processing/echo_detector/circular_buffer.h \
webrtc_dsp/modules/audio_processing/echo_detector/normalized_covariance_estimator.h \
webrtc_dsp/modules/audio_processing/echo_detector/mean_variance_estimator.h \
webrtc_dsp/modules/audio_processing/gain_control_for_experimental_agc.h \
webrtc_dsp/modules/audio_processing/rms_level.h \
webrtc_dsp/modules/audio_processing/ns/ns_core.h \
webrtc_dsp/modules/audio_processing/ns/defines.h \
webrtc_dsp/modules/audio_processing/ns/noise_suppression.h \
webrtc_dsp/modules/audio_processing/ns/nsx_core.h \
webrtc_dsp/modules/audio_processing/ns/windows_private.h \
webrtc_dsp/modules/audio_processing/ns/noise_suppression_x.h \
webrtc_dsp/modules/audio_processing/ns/nsx_defines.h \
webrtc_dsp/modules/audio_processing/residual_echo_detector.h \
webrtc_dsp/modules/audio_processing/audio_processing_impl.h \
webrtc_dsp/modules/audio_processing/render_queue_item_verifier.h \
webrtc_dsp/modules/audio_processing/include/audio_generator.h \
webrtc_dsp/modules/audio_processing/include/config.h \
webrtc_dsp/modules/audio_processing/include/audio_frame_view.h \
webrtc_dsp/modules/audio_processing/include/mock_audio_processing.h \
webrtc_dsp/modules/audio_processing/include/gain_control.h \
webrtc_dsp/modules/audio_processing/include/audio_generator_factory.h \
webrtc_dsp/modules/audio_processing/include/aec_dump.h \
webrtc_dsp/modules/audio_processing/include/audio_processing_statistics.h \
webrtc_dsp/modules/audio_processing/include/audio_processing.h \
webrtc_dsp/modules/audio_processing/agc2/interpolated_gain_curve.h \
webrtc_dsp/modules/audio_processing/agc2/biquad_filter.h \
webrtc_dsp/modules/audio_processing/agc2/agc2_testing_common.h \
webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator.h \
webrtc_dsp/modules/audio_processing/agc2/signal_classifier.h \
webrtc_dsp/modules/audio_processing/agc2/vector_float_frame.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/sequence_buffer.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/rnn.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/test_utils.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_info.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/lp_residual.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/ring_buffer.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/symmetric_matrix_buffer.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/features_extraction.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/common.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/fft_util.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search_internal.h \
webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search.h \
webrtc_dsp/modules/audio_processing/agc2/fixed_gain_controller.h \
webrtc_dsp/modules/audio_processing/agc2/down_sampler.h \
webrtc_dsp/modules/audio_processing/agc2/saturation_protector.h \
webrtc_dsp/modules/audio_processing/agc2/agc2_common.h \
webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.h \
webrtc_dsp/modules/audio_processing/agc2/adaptive_digital_gain_applier.h \
webrtc_dsp/modules/audio_processing/agc2/vad_with_level.h \
webrtc_dsp/modules/audio_processing/agc2/limiter_db_gain_curve.h \
webrtc_dsp/modules/audio_processing/agc2/fixed_digital_level_estimator.h \
webrtc_dsp/modules/audio_processing/agc2/adaptive_agc.h \
webrtc_dsp/modules/audio_processing/agc2/gain_applier.h \
webrtc_dsp/modules/audio_processing/agc2/noise_level_estimator.h \
webrtc_dsp/modules/audio_processing/agc2/compute_interpolated_gain_curve.h \
webrtc_dsp/modules/audio_processing/agc2/noise_spectrum_estimator.h \
webrtc_dsp/modules/audio_processing/agc2/limiter.h \
webrtc_dsp/modules/audio_processing/transient/transient_detector.h \
webrtc_dsp/modules/audio_processing/transient/transient_suppressor.h \
webrtc_dsp/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h \
webrtc_dsp/modules/audio_processing/transient/common.h \
webrtc_dsp/modules/audio_processing/transient/wpd_node.h \
webrtc_dsp/modules/audio_processing/transient/moving_moments.h \
webrtc_dsp/modules/audio_processing/transient/wpd_tree.h \
webrtc_dsp/modules/audio_processing/transient/dyadic_decimator.h \
webrtc_dsp/modules/audio_processing/noise_suppression_impl.h \
webrtc_dsp/modules/audio_processing/aec/aec_resampler.h \
webrtc_dsp/modules/audio_processing/aec/echo_cancellation.h \
webrtc_dsp/modules/audio_processing/aec/aec_core.h \
webrtc_dsp/modules/audio_processing/aec/aec_core_optimized_methods.h \
webrtc_dsp/modules/audio_processing/aec/aec_common.h \
webrtc_dsp/modules/audio_processing/voice_detection_impl.h \
webrtc_dsp/modules/audio_processing/agc/legacy/analog_agc.h \
webrtc_dsp/modules/audio_processing/agc/legacy/gain_control.h \
webrtc_dsp/modules/audio_processing/agc/legacy/digital_agc.h \
webrtc_dsp/modules/audio_processing/agc/mock_agc.h \
webrtc_dsp/modules/audio_processing/agc/loudness_histogram.h \
webrtc_dsp/modules/audio_processing/agc/gain_map_internal.h \
webrtc_dsp/modules/audio_processing/agc/utility.h \
webrtc_dsp/modules/audio_processing/agc/agc_manager_direct.h \
webrtc_dsp/modules/audio_processing/agc/agc.h \
webrtc_dsp/modules/audio_processing/common.h \
webrtc_dsp/modules/audio_processing/audio_buffer.h \
webrtc_dsp/modules/audio_processing/echo_control_mobile_impl.h \
webrtc_dsp/modules/audio_processing/splitting_filter.h \
webrtc_dsp/modules/audio_processing/low_cut_filter.h \
webrtc_dsp/modules/audio_processing/audio_generator/file_audio_generator.h \
webrtc_dsp/modules/audio_processing/three_band_filter_bank.h \
webrtc_dsp/modules/audio_processing/echo_cancellation_impl.h \
webrtc_dsp/modules/audio_processing/level_estimator_impl.h \
webrtc_dsp/modules/audio_processing/gain_controller2.h \
webrtc_dsp/modules/audio_processing/aecm/aecm_core.h \
webrtc_dsp/modules/audio_processing/aecm/aecm_defines.h \
webrtc_dsp/modules/audio_processing/aecm/echo_control_mobile.h \
webrtc_dsp/modules/audio_processing/aec3/downsampled_render_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/subtractor_output_analyzer.h \
webrtc_dsp/modules/audio_processing/aec3/residual_echo_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/shadow_filter_update_gain.h \
webrtc_dsp/modules/audio_processing/aec3/aec_state.h \
webrtc_dsp/modules/audio_processing/aec3/suppression_filter.h \
webrtc_dsp/modules/audio_processing/aec3/block_delay_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/adaptive_fir_filter.h \
webrtc_dsp/modules/audio_processing/aec3/cascaded_biquad_filter.h \
webrtc_dsp/modules/audio_processing/aec3/matched_filter.h \
webrtc_dsp/modules/audio_processing/aec3/subtractor_output.h \
webrtc_dsp/modules/audio_processing/aec3/render_signal_analyzer.h \
webrtc_dsp/modules/audio_processing/aec3/aec3_fft.h \
webrtc_dsp/modules/audio_processing/aec3/echo_remover_metrics.h \
webrtc_dsp/modules/audio_processing/aec3/filter_analyzer.h \
webrtc_dsp/modules/audio_processing/aec3/subtractor.h \
webrtc_dsp/modules/audio_processing/aec3/echo_path_delay_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/block_processor_metrics.h \
webrtc_dsp/modules/audio_processing/aec3/fft_data.h \
webrtc_dsp/modules/audio_processing/aec3/render_delay_controller_metrics.h \
webrtc_dsp/modules/audio_processing/aec3/comfort_noise_generator.h \
webrtc_dsp/modules/audio_processing/aec3/erl_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/echo_remover.h \
webrtc_dsp/modules/audio_processing/aec3/matrix_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/reverb_model_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/echo_path_variability.h \
webrtc_dsp/modules/audio_processing/aec3/moving_average.h \
webrtc_dsp/modules/audio_processing/aec3/render_reverb_model.h \
webrtc_dsp/modules/audio_processing/aec3/render_delay_controller.h \
webrtc_dsp/modules/audio_processing/aec3/suppression_gain.h \
webrtc_dsp/modules/audio_processing/aec3/erle_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/subband_erle_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/block_processor.h \
webrtc_dsp/modules/audio_processing/aec3/fullband_erle_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/stationarity_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/echo_canceller3.h \
webrtc_dsp/modules/audio_processing/aec3/skew_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/render_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/reverb_model_fallback.h \
webrtc_dsp/modules/audio_processing/aec3/vector_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/reverb_frequency_response.h \
webrtc_dsp/modules/audio_processing/aec3/echo_audibility.h \
webrtc_dsp/modules/audio_processing/aec3/fft_buffer.h \
webrtc_dsp/modules/audio_processing/aec3/aec3_common.h \
webrtc_dsp/modules/audio_processing/aec3/vector_math.h \
webrtc_dsp/modules/audio_processing/aec3/decimator.h \
webrtc_dsp/modules/audio_processing/aec3/frame_blocker.h \
webrtc_dsp/modules/audio_processing/aec3/block_framer.h \
webrtc_dsp/modules/audio_processing/aec3/suppression_gain_limiter.h \
webrtc_dsp/modules/audio_processing/aec3/delay_estimate.h \
webrtc_dsp/modules/audio_processing/aec3/reverb_model.h \
webrtc_dsp/modules/audio_processing/aec3/main_filter_update_gain.h \
webrtc_dsp/modules/audio_processing/aec3/matched_filter_lag_aggregator.h \
webrtc_dsp/modules/audio_processing/aec3/reverb_decay_estimator.h \
webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer.h \
webrtc_dsp/modules/audio_processing/gain_control_impl.h \
webrtc_dsp/modules/audio_processing/typing_detection.h \
webrtc_dsp/modules/audio_processing/logging/apm_data_dumper.h \
webrtc_dsp/modules/audio_processing/vad/vad_audio_proc_internal.h \
webrtc_dsp/modules/audio_processing/vad/vad_circular_buffer.h \
webrtc_dsp/modules/audio_processing/vad/pitch_based_vad.h \
webrtc_dsp/modules/audio_processing/vad/pole_zero_filter.h \
webrtc_dsp/modules/audio_processing/vad/gmm.h \
webrtc_dsp/modules/audio_processing/vad/common.h \
webrtc_dsp/modules/audio_processing/vad/vad_audio_proc.h \
webrtc_dsp/modules/audio_processing/vad/voice_gmm_tables.h \
webrtc_dsp/modules/audio_processing/vad/noise_gmm_tables.h \
webrtc_dsp/modules/audio_processing/vad/pitch_internal.h \
webrtc_dsp/modules/audio_processing/vad/standalone_vad.h \
webrtc_dsp/modules/audio_processing/vad/voice_activity_detector.h \
webrtc_dsp/modules/audio_processing/utility/ooura_fft_tables_neon_sse2.h \
webrtc_dsp/modules/audio_processing/utility/delay_estimator_internal.h \
webrtc_dsp/modules/audio_processing/utility/ooura_fft.h \
webrtc_dsp/modules/audio_processing/utility/block_mean_calculator.h \
webrtc_dsp/modules/audio_processing/utility/delay_estimator.h \
webrtc_dsp/modules/audio_processing/utility/ooura_fft_tables_common.h \
webrtc_dsp/modules/audio_processing/utility/delay_estimator_wrapper.h \
webrtc_dsp/common_audio/mocks/mock_smoothing_filter.h \
webrtc_dsp/common_audio/wav_file.h \
webrtc_dsp/common_audio/sparse_fir_filter.h \
webrtc_dsp/common_audio/fir_filter_sse.h \
webrtc_dsp/common_audio/window_generator.h \
webrtc_dsp/common_audio/ring_buffer.h \
webrtc_dsp/common_audio/fir_filter.h \
webrtc_dsp/common_audio/include/audio_util.h \
webrtc_dsp/common_audio/real_fourier_ooura.h \
webrtc_dsp/common_audio/smoothing_filter.h \
webrtc_dsp/common_audio/resampler/sinc_resampler.h \
webrtc_dsp/common_audio/resampler/include/push_resampler.h \
webrtc_dsp/common_audio/resampler/include/resampler.h \
webrtc_dsp/common_audio/resampler/push_sinc_resampler.h \
webrtc_dsp/common_audio/resampler/sinusoidal_linear_chirp_source.h \
webrtc_dsp/common_audio/fir_filter_factory.h \
webrtc_dsp/common_audio/audio_converter.h \
webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.h \
webrtc_dsp/common_audio/third_party/fft4g/fft4g.h \
webrtc_dsp/common_audio/channel_buffer.h \
webrtc_dsp/common_audio/real_fourier.h \
webrtc_dsp/common_audio/fir_filter_neon.h \
webrtc_dsp/common_audio/fir_filter_c.h \
webrtc_dsp/common_audio/signal_processing/complex_fft_tables.h \
webrtc_dsp/common_audio/signal_processing/include/signal_processing_library.h \
webrtc_dsp/common_audio/signal_processing/include/real_fft.h \
webrtc_dsp/common_audio/signal_processing/include/spl_inl.h \
webrtc_dsp/common_audio/signal_processing/include/spl_inl_armv7.h \
webrtc_dsp/common_audio/signal_processing/dot_product_with_scale.h \
webrtc_dsp/common_audio/signal_processing/resample_by_2_internal.h \
webrtc_dsp/common_audio/wav_header.h \
webrtc_dsp/common_audio/vad/vad_core.h \
webrtc_dsp/common_audio/vad/include/vad.h \
webrtc_dsp/common_audio/vad/include/webrtc_vad.h \
webrtc_dsp/common_audio/vad/vad_gmm.h \
webrtc_dsp/common_audio/vad/vad_sp.h \
webrtc_dsp/common_audio/vad/vad_filterbank.h
else
CFLAGS += -DTGVOIP_NO_DSP
endif
libtgvoip_la_SOURCES = $(SRC) $(TGVOIP_HDRS)
tgvoipincludedir = $(includedir)/tgvoip
nobase_tgvoipinclude_HEADERS = $(TGVOIP_HDRS)
CXXFLAGS += -std=gnu++0x $(CFLAGS)
if TARGET_OS_OSX
OBJCFLAGS = $(CFLAGS)
OBJCXXFLAGS += -std=gnu++0x $(CFLAGS)
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,433 +0,0 @@
#include "TgVoip.h"
#include "VoIPController.h"
#include "VoIPServerConfig.h"
#include <stdarg.h>
#ifndef TGVOIP_USE_CUSTOM_CRYPTO
extern "C" {
#include <openssl/sha.h>
#include <openssl/aes.h>
//#include <openssl/modes.h>
#include <openssl/rand.h>
}
void tgvoip_openssl_aes_ige_encrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
AES_KEY akey;
AES_set_encrypt_key(key, 32*8, &akey);
AES_ige_encrypt(in, out, length, &akey, iv, AES_ENCRYPT);
}
void tgvoip_openssl_aes_ige_decrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
AES_KEY akey;
AES_set_decrypt_key(key, 32*8, &akey);
AES_ige_encrypt(in, out, length, &akey, iv, AES_DECRYPT);
}
void tgvoip_openssl_rand_bytes(uint8_t* buffer, size_t len){
RAND_bytes(buffer, len);
}
void tgvoip_openssl_sha1(uint8_t* msg, size_t len, uint8_t* output){
SHA1(msg, len, output);
}
void tgvoip_openssl_sha256(uint8_t* msg, size_t len, uint8_t* output){
SHA256(msg, len, output);
}
void tgvoip_openssl_aes_ctr_encrypt(uint8_t* inout, size_t length, uint8_t* key, uint8_t* iv, uint8_t* ecount, uint32_t* num){
AES_KEY akey;
AES_set_encrypt_key(key, 32*8, &akey);
AES_ctr128_encrypt(inout, inout, length, &akey, iv, ecount, num);
}
void tgvoip_openssl_aes_cbc_encrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
AES_KEY akey;
AES_set_encrypt_key(key, 256, &akey);
AES_cbc_encrypt(in, out, length, &akey, iv, AES_ENCRYPT);
}
void tgvoip_openssl_aes_cbc_decrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
AES_KEY akey;
AES_set_decrypt_key(key, 256, &akey);
AES_cbc_encrypt(in, out, length, &akey, iv, AES_DECRYPT);
}
tgvoip::CryptoFunctions tgvoip::VoIPController::crypto={
tgvoip_openssl_rand_bytes,
tgvoip_openssl_sha1,
tgvoip_openssl_sha256,
tgvoip_openssl_aes_ige_encrypt,
tgvoip_openssl_aes_ige_decrypt,
tgvoip_openssl_aes_ctr_encrypt,
tgvoip_openssl_aes_cbc_encrypt,
tgvoip_openssl_aes_cbc_decrypt
};
#else
struct TgVoipCrypto {
void (*rand_bytes)(uint8_t* buffer, size_t length);
void (*sha1)(uint8_t* msg, size_t length, uint8_t* output);
void (*sha256)(uint8_t* msg, size_t length, uint8_t* output);
void (*aes_ige_encrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_ige_decrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_ctr_encrypt)(uint8_t* inout, size_t length, uint8_t* key, uint8_t* iv, uint8_t* ecount, uint32_t* num);
void (*aes_cbc_encrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_cbc_decrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
};
tgvoip::CryptoFunctions tgvoip::VoIPController::crypto; // set it yourself upon initialization
#endif
class TgVoipImpl : public TgVoip {
private:
tgvoip::VoIPController *controller_;
std::function<void(TgVoipState)> onStateUpdated_;
std::function<void(int)> onSignalBarsUpdated_;
public:
TgVoipImpl(
std::vector<TgVoipEndpoint> const &endpoints,
TgVoipPersistentState const &persistentState,
std::unique_ptr<TgVoipProxy> const &proxy,
TgVoipConfig const &config,
TgVoipEncryptionKey const &encryptionKey,
TgVoipNetworkType initialNetworkType
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
,
TgVoipCrypto const &crypto
#endif
#ifdef TGVOIP_USE_CALLBACK_AUDIO_IO
,
TgVoipAudioDataCallbacks const &audioDataCallbacks
#endif
) {
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
tgvoip::VoIPController::crypto.sha1 = crypto.sha1;
tgvoip::VoIPController::crypto.sha256 = crypto.sha256;
tgvoip::VoIPController::crypto.rand_bytes = crypto.rand_bytes;
tgvoip::VoIPController::crypto.aes_ige_encrypt = crypto.aes_ige_encrypt;
tgvoip::VoIPController::crypto.aes_ige_decrypt = crypto.aes_ige_decrypt;
tgvoip::VoIPController::crypto.aes_ctr_encrypt = crypto.aes_ctr_encrypt;
#endif
controller_ = new tgvoip::VoIPController();
controller_->implData = this;
#ifdef TGVOIP_USE_CALLBACK_AUDIO_IO
controller_->SetAudioDataCallbacks(audioDataCallbacks.input, audioDataCallbacks.output, audioDataCallbacks.preprocessed);
#endif
controller_->SetPersistentState(persistentState.value);
if (proxy != nullptr) {
controller_->SetProxy(tgvoip::PROXY_SOCKS5, proxy->host, proxy->port, proxy->login, proxy->password);
}
auto callbacks = tgvoip::VoIPController::Callbacks();
callbacks.connectionStateChanged = &TgVoipImpl::controllerStateCallback;
callbacks.groupCallKeyReceived = nullptr;
callbacks.groupCallKeySent = nullptr;
callbacks.signalBarCountChanged = &TgVoipImpl::signalBarsCallback;
callbacks.upgradeToGroupCallRequested = nullptr;
controller_->SetCallbacks(callbacks);
std::vector<tgvoip::Endpoint> mappedEndpoints;
for (auto endpoint : endpoints) {
bool isIpv6 = false;
struct in6_addr addrIpV6;
if (inet_pton(AF_INET6, endpoint.host.c_str(), &addrIpV6)) {
isIpv6 = true;
}
tgvoip::Endpoint::Type mappedType;
switch (endpoint.type) {
case TgVoipEndpointType::UdpRelay:
mappedType = tgvoip::Endpoint::Type::UDP_RELAY;
break;
case TgVoipEndpointType::Lan:
mappedType = tgvoip::Endpoint::Type::UDP_P2P_LAN;
break;
case TgVoipEndpointType::Inet:
mappedType = tgvoip::Endpoint::Type::UDP_P2P_INET;
break;
case TgVoipEndpointType::TcpRelay:
mappedType = tgvoip::Endpoint::Type::TCP_RELAY;
break;
default:
mappedType = tgvoip::Endpoint::Type::UDP_RELAY;
break;
}
tgvoip::IPv4Address address(isIpv6 ? std::string() : endpoint.host);
tgvoip::IPv6Address addressv6(isIpv6 ? endpoint.host : std::string());
mappedEndpoints.emplace_back(endpoint.endpointId, endpoint.port, address, addressv6, mappedType, endpoint.peerTag);
}
int mappedDataSaving;
switch (config.dataSaving) {
case TgVoipDataSaving::Mobile:
mappedDataSaving = tgvoip::DATA_SAVING_MOBILE;
break;
case TgVoipDataSaving::Always:
mappedDataSaving = tgvoip::DATA_SAVING_ALWAYS;
break;
default:
mappedDataSaving = tgvoip::DATA_SAVING_NEVER;
break;
}
tgvoip::VoIPController::Config mappedConfig(
config.initializationTimeout,
config.receiveTimeout,
mappedDataSaving,
config.enableAEC,
config.enableNS,
config.enableAGC,
config.enableCallUpgrade
);
mappedConfig.logFilePath = config.logPath;
mappedConfig.statsDumpFilePath = "";
controller_->SetConfig(mappedConfig);
setNetworkType(initialNetworkType);
std::vector<uint8_t> encryptionKeyValue = encryptionKey.value;
controller_->SetEncryptionKey((char *)(encryptionKeyValue.data()), encryptionKey.isOutgoing);
controller_->SetRemoteEndpoints(mappedEndpoints, config.enableP2P, config.maxApiLayer);
controller_->Start();
controller_->Connect();
}
~TgVoipImpl() override = default;
void setOnStateUpdated(std::function<void(TgVoipState)> onStateUpdated) override {
onStateUpdated_ = onStateUpdated;
}
void setOnSignalBarsUpdated(std::function<void(int)> onSignalBarsUpdated) override {
onSignalBarsUpdated_ = onSignalBarsUpdated;
}
void setNetworkType(TgVoipNetworkType networkType) override {
int mappedType;
switch (networkType) {
case TgVoipNetworkType::Unknown:
mappedType = tgvoip::NET_TYPE_UNKNOWN;
break;
case TgVoipNetworkType::Gprs:
mappedType = tgvoip::NET_TYPE_GPRS;
break;
case TgVoipNetworkType::Edge:
mappedType = tgvoip::NET_TYPE_EDGE;
break;
case TgVoipNetworkType::ThirdGeneration:
mappedType = tgvoip::NET_TYPE_3G;
break;
case TgVoipNetworkType::Hspa:
mappedType = tgvoip::NET_TYPE_HSPA;
break;
case TgVoipNetworkType::Lte:
mappedType = tgvoip::NET_TYPE_LTE;
break;
case TgVoipNetworkType::WiFi:
mappedType = tgvoip::NET_TYPE_WIFI;
break;
case TgVoipNetworkType::Ethernet:
mappedType = tgvoip::NET_TYPE_ETHERNET;
break;
case TgVoipNetworkType::OtherHighSpeed:
mappedType = tgvoip::NET_TYPE_OTHER_HIGH_SPEED;
break;
case TgVoipNetworkType::OtherLowSpeed:
mappedType = tgvoip::NET_TYPE_OTHER_LOW_SPEED;
break;
case TgVoipNetworkType::OtherMobile:
mappedType = tgvoip::NET_TYPE_OTHER_MOBILE;
break;
case TgVoipNetworkType::Dialup:
mappedType = tgvoip::NET_TYPE_DIALUP;
break;
default:
mappedType = tgvoip::NET_TYPE_UNKNOWN;
break;
}
controller_->SetNetworkType(mappedType);
}
void setMuteMicrophone(bool muteMicrophone) override {
controller_->SetMicMute(muteMicrophone);
}
void setAudioOutputGainControlEnabled(bool enabled) override {
controller_->SetAudioOutputGainControlEnabled(enabled);
}
void setEchoCancellationStrength(int strength) override {
controller_->SetEchoCancellationStrength(strength);
}
std::string getLastError() override {
switch (controller_->GetLastError()) {
case tgvoip::ERROR_INCOMPATIBLE: return "ERROR_INCOMPATIBLE";
case tgvoip::ERROR_TIMEOUT: return "ERROR_TIMEOUT";
case tgvoip::ERROR_AUDIO_IO: return "ERROR_AUDIO_IO";
case tgvoip::ERROR_PROXY: return "ERROR_PROXY";
default: return "ERROR_UNKNOWN";
}
}
std::string getDebugInfo() override {
return controller_->GetDebugString();
}
int64_t getPreferredRelayId() override {
return controller_->GetPreferredRelayID();
}
TgVoipTrafficStats getTrafficStats() override {
tgvoip::VoIPController::TrafficStats stats;
controller_->GetStats(&stats);
return {
.bytesSentWifi = stats.bytesSentWifi,
.bytesReceivedWifi = stats.bytesRecvdWifi,
.bytesSentMobile = stats.bytesSentMobile,
.bytesReceivedMobile = stats.bytesRecvdMobile
};
}
TgVoipPersistentState getPersistentState() override {
return {controller_->GetPersistentState()};
}
TgVoipFinalState stop() override {
controller_->Stop();
TgVoipFinalState finalState = {
.trafficStats = getTrafficStats(),
.persistentState = getPersistentState(),
.debugLog = controller_->GetDebugLog(),
.isRatingSuggested = controller_->NeedRate()
};
delete controller_;
controller_ = nullptr;
return finalState;
}
static void controllerStateCallback(tgvoip::VoIPController *controller, int state) {
auto *self = (TgVoipImpl *) controller->implData;
if (self->onStateUpdated_) {
TgVoipState mappedState;
switch (state) {
case tgvoip::STATE_WAIT_INIT:
mappedState = TgVoipState::WaitInit;
break;
case tgvoip::STATE_WAIT_INIT_ACK:
mappedState = TgVoipState::WaitInitAck;
break;
case tgvoip::STATE_ESTABLISHED:
mappedState = TgVoipState::Estabilished;
break;
case tgvoip::STATE_FAILED:
mappedState = TgVoipState::Failed;
break;
case tgvoip::STATE_RECONNECTING:
mappedState = TgVoipState::Reconnecting;
break;
default:
mappedState = TgVoipState::Estabilished;
break;
}
self->onStateUpdated_(mappedState);
}
}
static void signalBarsCallback(tgvoip::VoIPController *controller, int signalBars) {
auto *self = (TgVoipImpl *) controller->implData;
if (self->onSignalBarsUpdated_) {
self->onSignalBarsUpdated_(signalBars);
}
}
};
std::function<void(std::string const &)> globalLoggingFunction;
void __tgvoip_call_tglog(const char *format, ...){
va_list vaArgs;
va_start(vaArgs, format);
va_list vaCopy;
va_copy(vaCopy, vaArgs);
const int length = std::vsnprintf(nullptr, 0, format, vaCopy);
va_end(vaCopy);
std::vector<char> zc(length + 1);
std::vsnprintf(zc.data(), zc.size(), format, vaArgs);
va_end(vaArgs);
if (globalLoggingFunction != nullptr) {
globalLoggingFunction(std::string(zc.data(), zc.size()));
}
}
void TgVoip::setLoggingFunction(std::function<void(std::string const &)> loggingFunction) {
globalLoggingFunction = loggingFunction;
}
void TgVoip::setGlobalServerConfig(const std::string &serverConfig) {
tgvoip::ServerConfig::GetSharedInstance()->Update(serverConfig);
}
int TgVoip::getConnectionMaxLayer() {
return tgvoip::VoIPController::GetConnectionMaxLayer();
}
std::string TgVoip::getVersion() {
return tgvoip::VoIPController::GetVersion();
}
TgVoip *TgVoip::makeInstance(
TgVoipConfig const &config,
TgVoipPersistentState const &persistentState,
std::vector<TgVoipEndpoint> const &endpoints,
std::unique_ptr<TgVoipProxy> const &proxy,
TgVoipNetworkType initialNetworkType,
TgVoipEncryptionKey const &encryptionKey
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
,
TgVoipCrypto const &crypto
#endif
#ifdef TGVOIP_USE_CALLBACK_AUDIO_IO
,
TgVoipAudioDataCallbacks const &audioDataCallbacks
#endif
) {
return new TgVoipImpl(
endpoints,
persistentState,
proxy,
config,
encryptionKey,
initialNetworkType
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
,
crypto
#endif
#ifdef TGVOIP_USE_CALLBACK_AUDIO_IO
,
audioDataCallbacks
#endif
);
}
TgVoip::~TgVoip() = default;

View File

@ -1,160 +0,0 @@
#ifndef __TGVOIP_H
#define __TGVOIP_H
#include <functional>
#include <vector>
#include <string>
#include <memory>
struct TgVoipProxy {
std::string host;
uint16_t port;
std::string login;
std::string password;
};
enum class TgVoipEndpointType {
Inet,
Lan,
UdpRelay,
TcpRelay
};
struct TgVoipEndpoint {
int64_t endpointId;
std::string host;
uint16_t port;
TgVoipEndpointType type;
unsigned char peerTag[16];
};
enum class TgVoipNetworkType {
Unknown,
Gprs,
Edge,
ThirdGeneration,
Hspa,
Lte,
WiFi,
Ethernet,
OtherHighSpeed,
OtherLowSpeed,
OtherMobile,
Dialup
};
enum class TgVoipDataSaving {
Never,
Mobile,
Always
};
struct TgVoipPersistentState {
std::vector<uint8_t> value;
};
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
struct TgVoipCrypto {
void (*rand_bytes)(uint8_t* buffer, size_t length);
void (*sha1)(uint8_t* msg, size_t length, uint8_t* output);
void (*sha256)(uint8_t* msg, size_t length, uint8_t* output);
void (*aes_ige_encrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_ige_decrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_ctr_encrypt)(uint8_t* inout, size_t length, uint8_t* key, uint8_t* iv, uint8_t* ecount, uint32_t* num);
void (*aes_cbc_encrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
void (*aes_cbc_decrypt)(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv);
};
#endif
struct TgVoipConfig {
double initializationTimeout;
double receiveTimeout;
TgVoipDataSaving dataSaving;
bool enableP2P;
bool enableAEC;
bool enableNS;
bool enableAGC;
bool enableCallUpgrade;
std::string logPath;
int maxApiLayer;
};
struct TgVoipEncryptionKey {
std::vector<uint8_t> value;
bool isOutgoing;
};
enum class TgVoipState {
WaitInit,
WaitInitAck,
Estabilished,
Failed,
Reconnecting
};
struct TgVoipTrafficStats {
uint64_t bytesSentWifi;
uint64_t bytesReceivedWifi;
uint64_t bytesSentMobile;
uint64_t bytesReceivedMobile;
};
struct TgVoipFinalState {
TgVoipPersistentState persistentState;
std::string debugLog;
TgVoipTrafficStats trafficStats;
bool isRatingSuggested;
};
struct TgVoipAudioDataCallbacks {
std::function<void(int16_t*, size_t)> input;
std::function<void(int16_t*, size_t)> output;
std::function<void(int16_t*, size_t)> preprocessed;
};
class TgVoip {
protected:
TgVoip() = default;
public:
static void setLoggingFunction(std::function<void(std::string const &)> loggingFunction);
static void setGlobalServerConfig(std::string const &serverConfig);
static int getConnectionMaxLayer();
static std::string getVersion();
static TgVoip *makeInstance(
TgVoipConfig const &config,
TgVoipPersistentState const &persistentState,
std::vector<TgVoipEndpoint> const &endpoints,
std::unique_ptr<TgVoipProxy> const &proxy,
TgVoipNetworkType initialNetworkType,
TgVoipEncryptionKey const &encryptionKey
#ifdef TGVOIP_USE_CUSTOM_CRYPTO
,
TgVoipCrypto const &crypto
#endif
#ifdef TGVOIP_USE_CALLBACK_AUDIO_IO
,
TgVoipAudioDataCallbacks const &audioDataCallbacks
#endif
);
virtual ~TgVoip();
virtual void setNetworkType(TgVoipNetworkType networkType) = 0;
virtual void setMuteMicrophone(bool muteMicrophone) = 0;
virtual void setAudioOutputGainControlEnabled(bool enabled) = 0;
virtual void setEchoCancellationStrength(int strength) = 0;
virtual std::string getLastError() = 0;
virtual std::string getDebugInfo() = 0;
virtual int64_t getPreferredRelayId() = 0;
virtual TgVoipTrafficStats getTrafficStats() = 0;
virtual TgVoipPersistentState getPersistentState() = 0;
virtual void setOnStateUpdated(std::function<void(TgVoipState)> onStateUpdated) = 0;
virtual void setOnSignalBarsUpdated(std::function<void(int)> onSignalBarsUpdated) = 0;
virtual TgVoipFinalState stop() = 0;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,444 @@
#include "org_telegram_messenger_voip_Instance.h"
#include <jni.h>
#include <sdk/android/native_api/video/wrapper.h>
#include <VideoCapturerInterface.h>
#include <platform/android/AndroidInterface.h>
#include <platform/android/AndroidContext.h>
#include "pc/video_track.h"
#include "legacy/InstanceImplLegacy.h"
#include "InstanceImpl.h"
#include "reference/InstanceImplReference.h"
#include "libtgvoip/os/android/AudioOutputOpenSLES.h"
#include "libtgvoip/os/android/AudioInputOpenSLES.h"
#include "libtgvoip/os/android/JNIUtilities.h"
#include "tgcalls/VideoCaptureInterface.h"
using namespace tgcalls;
const auto RegisterTag = Register<InstanceImpl>();
const auto RegisterTagLegacy = Register<InstanceImplLegacy>();
const auto RegisterTagReference = tgcalls::Register<InstanceImplReference>();
class JavaObject {
private:
JNIEnv *env;
jobject obj;
jclass clazz;
public:
JavaObject(JNIEnv *env, jobject obj) : JavaObject(env, obj, env->GetObjectClass(obj)) {
}
JavaObject(JNIEnv *env, jobject obj, jclass clazz) {
this->env = env;
this->obj = obj;
this->clazz = clazz;
}
jint getIntField(const char *name) {
return env->GetIntField(obj, env->GetFieldID(clazz, name, "I"));
}
jlong getLongField(const char *name) {
return env->GetLongField(obj, env->GetFieldID(clazz, name, "J"));
}
jboolean getBooleanField(const char *name) {
return env->GetBooleanField(obj, env->GetFieldID(clazz, name, "Z"));
}
jdouble getDoubleField(const char *name) {
return env->GetDoubleField(obj, env->GetFieldID(clazz, name, "D"));
}
jbyteArray getByteArrayField(const char *name) {
return (jbyteArray) env->GetObjectField(obj, env->GetFieldID(clazz, name, "[B"));
}
jstring getStringField(const char *name) {
return (jstring) env->GetObjectField(obj, env->GetFieldID(clazz, name, "Ljava/lang/String;"));
}
};
struct InstanceHolder {
std::unique_ptr<Instance> nativeInstance;
jobject javaInstance;
std::shared_ptr<tgcalls::VideoCaptureInterface> _videoCapture;
};
jlong getInstanceHolderId(JNIEnv *env, jobject obj) {
return env->GetLongField(obj, env->GetFieldID(env->GetObjectClass(obj), "nativePtr", "J"));
}
InstanceHolder *getInstanceHolder(JNIEnv *env, jobject obj) {
return reinterpret_cast<InstanceHolder *>(getInstanceHolderId(env, obj));
}
Instance *getInstance(JNIEnv *env, jobject obj) {
return getInstanceHolder(env, obj)->nativeInstance.get();
}
jint throwNewJavaException(JNIEnv *env, const char *className, const char *message) {
return env->ThrowNew(env->FindClass(className), message);
}
jint throwNewJavaIllegalArgumentException(JNIEnv *env, const char *message) {
return throwNewJavaException(env, "java/lang/IllegalStateException", message);
}
jbyteArray copyVectorToJavaByteArray(JNIEnv *env, const std::vector<uint8_t> &bytes) {
unsigned int size = bytes.size();
jbyteArray bytesArray = env->NewByteArray(size);
env->SetByteArrayRegion(bytesArray, 0, size, (jbyte *) bytes.data());
return bytesArray;
}
void readPersistentState(const char *filePath, PersistentState &persistentState) {
FILE *persistentStateFile = fopen(filePath, "r");
if (persistentStateFile) {
fseek(persistentStateFile, 0, SEEK_END);
auto len = static_cast<size_t>(ftell(persistentStateFile));
fseek(persistentStateFile, 0, SEEK_SET);
if (len < 1024 * 512 && len > 0) {
auto *buffer = static_cast<uint8_t *>(malloc(len));
fread(buffer, 1, len, persistentStateFile);
persistentState.value = std::vector<uint8_t>(buffer, buffer + len);
free(buffer);
}
fclose(persistentStateFile);
}
}
void savePersistentState(const char *filePath, const PersistentState &persistentState) {
FILE *persistentStateFile = fopen(filePath, "w");
if (persistentStateFile) {
fwrite(persistentState.value.data(), 1, persistentState.value.size(), persistentStateFile);
fclose(persistentStateFile);
}
}
NetworkType parseNetworkType(jint networkType) {
switch (networkType) {
case org_telegram_messenger_voip_Instance_NET_TYPE_GPRS:
return NetworkType::Gprs;
case org_telegram_messenger_voip_Instance_NET_TYPE_EDGE:
return NetworkType::Edge;
case org_telegram_messenger_voip_Instance_NET_TYPE_3G:
return NetworkType::ThirdGeneration;
case org_telegram_messenger_voip_Instance_NET_TYPE_HSPA:
return NetworkType::Hspa;
case org_telegram_messenger_voip_Instance_NET_TYPE_LTE:
return NetworkType::Lte;
case org_telegram_messenger_voip_Instance_NET_TYPE_WIFI:
return NetworkType::WiFi;
case org_telegram_messenger_voip_Instance_NET_TYPE_ETHERNET:
return NetworkType::Ethernet;
case org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_HIGH_SPEED:
return NetworkType::OtherHighSpeed;
case org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_LOW_SPEED:
return NetworkType::OtherLowSpeed;
case org_telegram_messenger_voip_Instance_NET_TYPE_DIALUP:
return NetworkType::Dialup;
case org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_MOBILE:
return NetworkType::OtherMobile;
default:
return NetworkType::Unknown;
}
}
DataSaving parseDataSaving(JNIEnv *env, jint dataSaving) {
switch (dataSaving) {
case org_telegram_messenger_voip_Instance_DATA_SAVING_NEVER:
return DataSaving::Never;
case org_telegram_messenger_voip_Instance_DATA_SAVING_MOBILE:
return DataSaving::Mobile;
case org_telegram_messenger_voip_Instance_DATA_SAVING_ALWAYS:
return DataSaving::Always;
case org_telegram_messenger_voip_Instance_DATA_SAVING_ROAMING:
throwNewJavaIllegalArgumentException(env, "DATA_SAVING_ROAMING is not supported");
return DataSaving::Never;
default:
throwNewJavaIllegalArgumentException(env, "Unknown data saving constant: " + dataSaving);
return DataSaving::Never;
}
}
EndpointType parseEndpointType(JNIEnv *env, jint endpointType) {
switch (endpointType) {
case org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_INET:
return EndpointType::Inet;
case org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_LAN:
return EndpointType::Lan;
case org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_TCP_RELAY:
return EndpointType::TcpRelay;
case org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_UDP_RELAY:
return EndpointType::UdpRelay;
default:
throwNewJavaIllegalArgumentException(env, std::string("Unknown endpoint type: ").append(std::to_string(endpointType)).c_str());
return EndpointType::UdpRelay;
}
}
jint asJavaState(const State &state) {
switch (state) {
case State::WaitInit:
return org_telegram_messenger_voip_Instance_STATE_WAIT_INIT;
case State::WaitInitAck:
return org_telegram_messenger_voip_Instance_STATE_WAIT_INIT_ACK;
case State::Established:
return org_telegram_messenger_voip_Instance_STATE_ESTABLISHED;
case State::Failed:
return org_telegram_messenger_voip_Instance_STATE_FAILED;
case State::Reconnecting:
return org_telegram_messenger_voip_Instance_STATE_RECONNECTING;
}
}
jobject asJavaTrafficStats(JNIEnv *env, const TrafficStats &trafficStats) {
jclass clazz = env->FindClass("org/telegram/messenger/voip/Instance$TrafficStats");
jmethodID initMethodId = env->GetMethodID(clazz, "<init>", "(JJJJ)V");
return env->NewObject(clazz, initMethodId, (jlong) trafficStats.bytesSentWifi, (jlong) trafficStats.bytesReceivedWifi, (jlong) trafficStats.bytesSentMobile, (jlong) trafficStats.bytesReceivedMobile);
}
jobject asJavaFinalState(JNIEnv *env, const FinalState &finalState) {
jbyteArray persistentState = copyVectorToJavaByteArray(env, finalState.persistentState.value);
jstring debugLog = env->NewStringUTF(finalState.debugLog.c_str());
jobject trafficStats = asJavaTrafficStats(env, finalState.trafficStats);
auto isRatingSuggested = static_cast<jboolean>(finalState.isRatingSuggested);
jclass finalStateClass = env->FindClass("org/telegram/messenger/voip/Instance$FinalState");
jmethodID finalStateInitMethodId = env->GetMethodID(finalStateClass, "<init>", "([BLjava/lang/String;Lorg/telegram/messenger/voip/Instance$TrafficStats;Z)V");
return env->NewObject(finalStateClass, finalStateInitMethodId, persistentState, debugLog, trafficStats, isRatingSuggested);
}
extern "C" {
JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNativeInstance(JNIEnv *env, jclass clazz, jstring version, jobject instanceObj, jobject config, jstring persistentStateFilePath, jobjectArray endpoints, jobject proxyClass, jint networkType, jobject encryptionKey, jobject remoteSink, jlong videoCapturer, jfloat aspectRatio) {
JavaObject configObject(env, config);
JavaObject encryptionKeyObject(env, encryptionKey);
std::string v = tgvoip::jni::JavaStringToStdString(env, version);
jbyteArray valueByteArray = encryptionKeyObject.getByteArrayField("value");
auto *valueBytes = (uint8_t *) env->GetByteArrayElements(valueByteArray, nullptr);
auto encryptionKeyValue = std::make_shared<std::array<uint8_t, 256>>();
memcpy(encryptionKeyValue->data(), valueBytes, 256);
env->ReleaseByteArrayElements(valueByteArray, (jbyte *) valueBytes, JNI_ABORT);
jobject globalRef = env->NewGlobalRef(instanceObj);
std::shared_ptr<VideoCaptureInterface> videoCapture = videoCapturer ? std::shared_ptr<VideoCaptureInterface>(reinterpret_cast<VideoCaptureInterface *>(videoCapturer)) : nullptr;
Descriptor descriptor = {
.config = Config{
.initializationTimeout = configObject.getDoubleField("initializationTimeout"),
.receiveTimeout = configObject.getDoubleField("receiveTimeout"),
.dataSaving = parseDataSaving(env, configObject.getIntField("dataSaving")),
.enableP2P = configObject.getBooleanField("enableP2p") == JNI_TRUE,
.enableAEC = configObject.getBooleanField("enableAec") == JNI_TRUE,
.enableNS = configObject.getBooleanField("enableNs") == JNI_TRUE,
.enableAGC = configObject.getBooleanField("enableAgc") == JNI_TRUE,
.enableVolumeControl = true,
.logPath = tgvoip::jni::JavaStringToStdString(env, configObject.getStringField("logPath")),
.maxApiLayer = configObject.getIntField("maxApiLayer"),
/*.preferredAspectRatio = aspectRatio*/
},
.encryptionKey = EncryptionKey(
std::move(encryptionKeyValue),
encryptionKeyObject.getBooleanField("isOutgoing") == JNI_TRUE),
.videoCapture = videoCapture,
.stateUpdated = [globalRef](State state) {
jint javaState = asJavaState(state);
tgvoip::jni::DoWithJNI([globalRef, javaState](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onStateUpdated", "(I)V"), javaState);
});
},
.signalBarsUpdated = [globalRef](int count) {
tgvoip::jni::DoWithJNI([globalRef, count](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onSignalBarsUpdated", "(I)V"), count);
});
},
.remoteMediaStateUpdated = [globalRef](AudioState audioState, VideoState videoState) {
tgvoip::jni::DoWithJNI([globalRef, audioState, videoState](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onRemoteMediaStateUpdated", "(II)V"), audioState, videoState);
});
},
.signalingDataEmitted = [globalRef](const std::vector<uint8_t> &data) {
tgvoip::jni::DoWithJNI([globalRef, data](JNIEnv *env) {
jbyteArray arr = copyVectorToJavaByteArray(env, data);
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onSignalingData", "([B)V"), arr);
});
},
};
for (int i = 0, size = env->GetArrayLength(endpoints); i < size; i++) {
JavaObject endpointObject(env, env->GetObjectArrayElement(endpoints, i));
bool isRtc = endpointObject.getBooleanField("isRtc");
if (isRtc) {
RtcServer rtcServer;
rtcServer.host = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4"));
rtcServer.port = static_cast<uint16_t>(endpointObject.getIntField("port"));
rtcServer.login = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("username"));
rtcServer.password = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("password"));
rtcServer.isTurn = endpointObject.getBooleanField("turn");
descriptor.rtcServers.push_back(std::move(rtcServer));
} else {
Endpoint endpoint;
endpoint.endpointId = endpointObject.getLongField("id");
endpoint.host = EndpointHost{tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4")), tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv6"))};
endpoint.port = static_cast<uint16_t>(endpointObject.getIntField("port"));
endpoint.type = parseEndpointType(env, endpointObject.getIntField("type"));
jbyteArray peerTag = endpointObject.getByteArrayField("peerTag");
if (peerTag && env->GetArrayLength(peerTag)) {
jbyte *peerTagBytes = env->GetByteArrayElements(peerTag, nullptr);
memcpy(endpoint.peerTag, peerTagBytes, 16);
env->ReleaseByteArrayElements(peerTag, peerTagBytes, JNI_ABORT);
}
descriptor.endpoints.push_back(std::move(endpoint));
}
}
if (!env->IsSameObject(proxyClass, nullptr)) {
JavaObject proxyObject(env, proxyClass);
descriptor.proxy = std::unique_ptr<Proxy>(new Proxy);
descriptor.proxy->host = tgvoip::jni::JavaStringToStdString(env, proxyObject.getStringField("host"));
descriptor.proxy->port = static_cast<uint16_t>(proxyObject.getIntField("port"));
descriptor.proxy->login = tgvoip::jni::JavaStringToStdString(env, proxyObject.getStringField("login"));
descriptor.proxy->password = tgvoip::jni::JavaStringToStdString(env, proxyObject.getStringField("password"));
}
readPersistentState(tgvoip::jni::JavaStringToStdString(env, persistentStateFilePath).c_str(), descriptor.persistentState);
auto *holder = new InstanceHolder;
holder->nativeInstance = tgcalls::Meta::Create(v, std::move(descriptor));
holder->javaInstance = globalRef;
holder->_videoCapture = videoCapture;
holder->nativeInstance->setIncomingVideoOutput(webrtc::JavaToNativeVideoSink(env, remoteSink));
return reinterpret_cast<jlong>(holder);
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setGlobalServerConfig(JNIEnv *env, jobject obj, jstring serverConfigJson) {
SetLegacyGlobalServerConfig(tgvoip::jni::JavaStringToStdString(env, serverConfigJson));
}
JNIEXPORT jstring JNICALL Java_org_telegram_messenger_voip_NativeInstance_getVersion(JNIEnv *env, jobject obj) {
return env->NewStringUTF(tgvoip::VoIPController::GetVersion());
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setBufferSize(JNIEnv *env, jobject obj, jint size) {
tgvoip::audio::AudioOutputOpenSLES::nativeBufferSize = (unsigned int) size;
tgvoip::audio::AudioInputOpenSLES::nativeBufferSize = (unsigned int) size;
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setNetworkType(JNIEnv *env, jobject obj, jint networkType) {
getInstance(env, obj)->setNetworkType(parseNetworkType(networkType));
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setMuteMicrophone(JNIEnv *env, jobject obj, jboolean muteMicrophone) {
getInstance(env, obj)->setMuteMicrophone(muteMicrophone);
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setAudioOutputGainControlEnabled(JNIEnv *env, jobject obj, jboolean enabled) {
getInstance(env, obj)->setAudioOutputGainControlEnabled(enabled);
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setEchoCancellationStrength(JNIEnv *env, jobject obj, jint strength) {
getInstance(env, obj)->setEchoCancellationStrength(strength);
}
JNIEXPORT jstring JNICALL Java_org_telegram_messenger_voip_NativeInstance_getLastError(JNIEnv *env, jobject obj) {
return env->NewStringUTF(getInstance(env, obj)->getLastError().c_str());
}
JNIEXPORT jstring JNICALL Java_org_telegram_messenger_voip_NativeInstance_getDebugInfo(JNIEnv *env, jobject obj) {
return env->NewStringUTF(getInstance(env, obj)->getDebugInfo().c_str());
}
JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_getPreferredRelayId(JNIEnv *env, jobject obj) {
return getInstance(env, obj)->getPreferredRelayId();
}
JNIEXPORT jobject JNICALL Java_org_telegram_messenger_voip_NativeInstance_getTrafficStats(JNIEnv *env, jobject obj) {
return asJavaTrafficStats(env, getInstance(env, obj)->getTrafficStats());
}
JNIEXPORT jbyteArray JNICALL Java_org_telegram_messenger_voip_NativeInstance_getPersistentState(JNIEnv *env, jobject obj) {
return copyVectorToJavaByteArray(env, getInstance(env, obj)->getPersistentState().value);
}
JNIEXPORT jobject JNICALL Java_org_telegram_messenger_voip_NativeInstance_stop(JNIEnv *env, jobject obj) {
InstanceHolder *instance = getInstanceHolder(env, obj);
FinalState finalState = instance->nativeInstance->stop();
// saving persistent state
const std::string &path = tgvoip::jni::JavaStringToStdString(env, JavaObject(env, obj).getStringField("persistentStateFilePath"));
savePersistentState(path.c_str(), finalState.persistentState);
// clean
env->DeleteGlobalRef(instance->javaInstance);
delete instance;
return asJavaFinalState(env, finalState);
}
JNIEXPORT long JNICALL Java_org_telegram_messenger_voip_NativeInstance_createVideoCapturer(JNIEnv *env, jclass clazz, jobject localSink) {
std::unique_ptr<VideoCaptureInterface> capture = tgcalls::VideoCaptureInterface::Create(std::make_shared<AndroidContext>(env));
capture->setOutput(webrtc::JavaToNativeVideoSink(env, localSink));
capture->setState(VideoState::Active);
return reinterpret_cast<intptr_t>(capture.release());
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_destroyVideoCapturer(JNIEnv *env, jclass clazz, jlong videoCapturer) {
VideoCaptureInterface *capturer = reinterpret_cast<VideoCaptureInterface *>(videoCapturer);
delete capturer;
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_switchCameraCapturer(JNIEnv *env, jclass clazz, jlong videoCapturer) {
VideoCaptureInterface *capturer = reinterpret_cast<VideoCaptureInterface *>(videoCapturer);
capturer->switchCamera();
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setVideoStateCapturer(JNIEnv *env, jclass clazz, jlong videoCapturer, jint videoState) {
VideoCaptureInterface *capturer = reinterpret_cast<VideoCaptureInterface *>(videoCapturer);
capturer->setState(static_cast<VideoState>(videoState));
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_switchCamera(JNIEnv *env, jobject obj) {
InstanceHolder *instance = getInstanceHolder(env, obj);
if (instance->_videoCapture == nullptr) {
return;
}
instance->_videoCapture->switchCamera();
}
JNIEXPORT void Java_org_telegram_messenger_voip_NativeInstance_setVideoState(JNIEnv *env, jobject obj, jint state) {
InstanceHolder *instance = getInstanceHolder(env, obj);
if (instance->_videoCapture == nullptr) {
return;
}
instance->_videoCapture->setState(static_cast<VideoState>(state));
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_setupOutgoingVideo(JNIEnv *env, jobject obj, jobject localSink) {
InstanceHolder *instance = getInstanceHolder(env, obj);
if (instance->_videoCapture) {
return;
}
instance->_videoCapture = tgcalls::VideoCaptureInterface::Create(std::make_shared<AndroidContext>(env));
instance->_videoCapture->setOutput(webrtc::JavaToNativeVideoSink(env, localSink));
instance->_videoCapture->setState(VideoState::Active);
instance->nativeInstance->setVideoCapture(instance->_videoCapture);
}
JNIEXPORT void JNICALL Java_org_telegram_messenger_voip_NativeInstance_onSignalingDataReceive(JNIEnv *env, jobject obj, jbyteArray value) {
InstanceHolder *instance = getInstanceHolder(env, obj);
auto *valueBytes = (uint8_t *) env->GetByteArrayElements(value, nullptr);
const size_t size = env->GetArrayLength(value);
auto array = std::vector<uint8_t>(size);
memcpy(&array[0], valueBytes, size);
instance->nativeInstance->receiveSignalingData(std::move(array));
env->ReleaseByteArrayElements(value, (jbyte *) valueBytes, JNI_ABORT);
}
}

View File

@ -0,0 +1,64 @@
#include <jni.h>
#ifndef _Included_org_telegram_messenger_voip_Instance
#define _Included_org_telegram_messenger_voip_Instance
#ifdef __cplusplus
extern "C" {
#endif
#undef org_telegram_messenger_voip_Instance_NET_TYPE_UNKNOWN
#define org_telegram_messenger_voip_Instance_NET_TYPE_UNKNOWN 0L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_GPRS
#define org_telegram_messenger_voip_Instance_NET_TYPE_GPRS 1L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_EDGE
#define org_telegram_messenger_voip_Instance_NET_TYPE_EDGE 2L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_3G
#define org_telegram_messenger_voip_Instance_NET_TYPE_3G 3L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_HSPA
#define org_telegram_messenger_voip_Instance_NET_TYPE_HSPA 4L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_LTE
#define org_telegram_messenger_voip_Instance_NET_TYPE_LTE 5L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_WIFI
#define org_telegram_messenger_voip_Instance_NET_TYPE_WIFI 6L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_ETHERNET
#define org_telegram_messenger_voip_Instance_NET_TYPE_ETHERNET 7L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_HIGH_SPEED
#define org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_HIGH_SPEED 8L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_LOW_SPEED
#define org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_LOW_SPEED 9L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_DIALUP
#define org_telegram_messenger_voip_Instance_NET_TYPE_DIALUP 10L
#undef org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_MOBILE
#define org_telegram_messenger_voip_Instance_NET_TYPE_OTHER_MOBILE 11L
#undef org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_INET
#define org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_INET 0L
#undef org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_LAN
#define org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_LAN 1L
#undef org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_UDP_RELAY
#define org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_UDP_RELAY 2L
#undef org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_TCP_RELAY
#define org_telegram_messenger_voip_Instance_ENDPOINT_TYPE_TCP_RELAY 3L
#undef org_telegram_messenger_voip_Instance_STATE_WAIT_INIT
#define org_telegram_messenger_voip_Instance_STATE_WAIT_INIT 1L
#undef org_telegram_messenger_voip_Instance_STATE_WAIT_INIT_ACK
#define org_telegram_messenger_voip_Instance_STATE_WAIT_INIT_ACK 2L
#undef org_telegram_messenger_voip_Instance_STATE_ESTABLISHED
#define org_telegram_messenger_voip_Instance_STATE_ESTABLISHED 3L
#undef org_telegram_messenger_voip_Instance_STATE_FAILED
#define org_telegram_messenger_voip_Instance_STATE_FAILED 4L
#undef org_telegram_messenger_voip_Instance_STATE_RECONNECTING
#define org_telegram_messenger_voip_Instance_STATE_RECONNECTING 5L
#undef org_telegram_messenger_voip_Instance_DATA_SAVING_NEVER
#define org_telegram_messenger_voip_Instance_DATA_SAVING_NEVER 0L
#undef org_telegram_messenger_voip_Instance_DATA_SAVING_MOBILE
#define org_telegram_messenger_voip_Instance_DATA_SAVING_MOBILE 1L
#undef org_telegram_messenger_voip_Instance_DATA_SAVING_ALWAYS
#define org_telegram_messenger_voip_Instance_DATA_SAVING_ALWAYS 2L
#undef org_telegram_messenger_voip_Instance_DATA_SAVING_ROAMING
#define org_telegram_messenger_voip_Instance_DATA_SAVING_ROAMING 3L
#undef org_telegram_messenger_voip_Instance_PEER_CAP_GROUP_CALLS
#define org_telegram_messenger_voip_Instance_PEER_CAP_GROUP_CALLS 1L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,402 +0,0 @@
#include <jni.h>
#include <TgVoip.h>
#include <os/android/AudioOutputOpenSLES.h>
#include <os/android/AudioInputOpenSLES.h>
#include <os/android/JNIUtilities.h>
#include "org_telegram_messenger_voip_TgVoip.h"
using namespace tgvoip;
extern "C" int tgvoipOnJniLoad(JavaVM *vm, JNIEnv *env) {
return JNI_TRUE;
}
#pragma mark - Helpers
class JavaObject {
private:
JNIEnv *env;
jobject obj;
jclass clazz;
public:
JavaObject(JNIEnv *env, jobject obj) : JavaObject(env, obj, env->GetObjectClass(obj)) {
}
JavaObject(JNIEnv *env, jobject obj, jclass clazz) {
this->env = env;
this->obj = obj;
this->clazz = clazz;
}
jint getIntField(const char *name) {
return env->GetIntField(obj, env->GetFieldID(clazz, name, "I"));
}
jlong getLongField(const char *name) {
return env->GetLongField(obj, env->GetFieldID(clazz, name, "J"));
}
jboolean getBooleanField(const char *name) {
return env->GetBooleanField(obj, env->GetFieldID(clazz, name, "Z"));
}
jdouble getDoubleField(const char *name) {
return env->GetDoubleField(obj, env->GetFieldID(clazz, name, "D"));
}
jbyteArray getByteArrayField(const char *name) {
return (jbyteArray) env->GetObjectField(obj, env->GetFieldID(clazz, name, "[B"));
}
jstring getStringField(const char *name) {
return (jstring) env->GetObjectField(obj, env->GetFieldID(clazz, name, "Ljava/lang/String;"));
}
};
struct InstanceHolder {
TgVoip *nativeInstance;
jobject javaInstance;
};
jlong getInstanceHolderId(JNIEnv *env, jobject obj) {
return env->GetLongField(obj, env->GetFieldID(env->GetObjectClass(obj), "nativeInstanceId", "J"));
}
InstanceHolder *getInstanceHolder(JNIEnv *env, jobject obj) {
return reinterpret_cast<InstanceHolder *>(getInstanceHolderId(env, obj));
}
TgVoip *getTgVoip(JNIEnv *env, jobject obj) {
return getInstanceHolder(env, obj)->nativeInstance;
}
jint throwNewJavaException(JNIEnv *env, const char *className, const char *message) {
return env->ThrowNew(env->FindClass(className), message);
}
jint throwNewJavaIllegalArgumentException(JNIEnv *env, const char *message) {
return throwNewJavaException(env, "java/lang/IllegalStateException", message);
}
jbyteArray copyVectorToJavaByteArray(JNIEnv *env, const std::vector<uint8_t> &bytes) {
unsigned int size = bytes.size();
jbyteArray bytesArray = env->NewByteArray(size);
env->SetByteArrayRegion(bytesArray, 0, size, (jbyte *) bytes.data());
return bytesArray;
}
void readTgVoipPersistentState(const char *filePath, TgVoipPersistentState &tgVoipPersistentState) {
FILE *persistentStateFile = fopen(filePath, "r");
if (persistentStateFile) {
fseek(persistentStateFile, 0, SEEK_END);
auto len = static_cast<size_t>(ftell(persistentStateFile));
fseek(persistentStateFile, 0, SEEK_SET);
if (len < 1024 * 512 && len > 0) {
auto *buffer = static_cast<uint8_t *>(malloc(len));
fread(buffer, 1, len, persistentStateFile);
tgVoipPersistentState.value = std::vector<uint8_t>(buffer, buffer + len);
free(buffer);
}
fclose(persistentStateFile);
}
}
void saveTgVoipPersistentState(const char *filePath, const TgVoipPersistentState &tgVoipPersistentState) {
FILE *persistentStateFile = fopen(filePath, "w");
if (persistentStateFile) {
fwrite(tgVoipPersistentState.value.data(), 1, tgVoipPersistentState.value.size(), persistentStateFile);
fclose(persistentStateFile);
}
}
#pragma mark - Mappers
TgVoipNetworkType parseTgVoipNetworkType(jint networkType) {
switch (networkType) {
case org_telegram_messenger_voip_TgVoip_NET_TYPE_GPRS:
return TgVoipNetworkType::Gprs;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_EDGE:
return TgVoipNetworkType::Edge;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_3G:
return TgVoipNetworkType::ThirdGeneration;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_HSPA:
return TgVoipNetworkType::Hspa;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_LTE:
return TgVoipNetworkType::Lte;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_WIFI:
return TgVoipNetworkType::WiFi;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_ETHERNET:
return TgVoipNetworkType::Ethernet;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_HIGH_SPEED:
return TgVoipNetworkType::OtherHighSpeed;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_LOW_SPEED:
return TgVoipNetworkType::OtherLowSpeed;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_DIALUP:
return TgVoipNetworkType::Dialup;
case org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_MOBILE:
return TgVoipNetworkType::OtherMobile;
default:
return TgVoipNetworkType::Unknown;
}
}
TgVoipDataSaving parseTgVoipDataSaving(JNIEnv *env, jint dataSaving) {
switch (dataSaving) {
case org_telegram_messenger_voip_TgVoip_DATA_SAVING_NEVER:
return TgVoipDataSaving::Never;
case org_telegram_messenger_voip_TgVoip_DATA_SAVING_MOBILE:
return TgVoipDataSaving::Mobile;
case org_telegram_messenger_voip_TgVoip_DATA_SAVING_ALWAYS:
return TgVoipDataSaving::Always;
case org_telegram_messenger_voip_TgVoip_DATA_SAVING_ROAMING:
throwNewJavaIllegalArgumentException(env, "DATA_SAVING_ROAMING is not supported");
return TgVoipDataSaving::Never;
default:
throwNewJavaIllegalArgumentException(env, "Unknown data saving constant: " + dataSaving);
return TgVoipDataSaving::Never;
}
}
void parseTgVoipConfig(JNIEnv *env, jobject config, TgVoipConfig &tgVoipConfig) {
JavaObject configObject(env, config);
tgVoipConfig.initializationTimeout = configObject.getDoubleField("initializationTimeout");
tgVoipConfig.receiveTimeout = configObject.getDoubleField("receiveTimeout");
tgVoipConfig.dataSaving = parseTgVoipDataSaving(env, configObject.getIntField("dataSaving"));
tgVoipConfig.enableP2P = configObject.getBooleanField("enableP2p") == JNI_TRUE;
tgVoipConfig.enableAEC = configObject.getBooleanField("enableAec") == JNI_TRUE;
tgVoipConfig.enableNS = configObject.getBooleanField("enableNs") == JNI_TRUE;
tgVoipConfig.enableAGC = configObject.getBooleanField("enableAgc") == JNI_TRUE;
tgVoipConfig.enableCallUpgrade = configObject.getBooleanField("enableCallUpgrade") == JNI_TRUE;
tgVoipConfig.logPath = jni::JavaStringToStdString(env, configObject.getStringField("logPath"));
tgVoipConfig.maxApiLayer = configObject.getIntField("maxApiLayer");
}
TgVoipEndpointType parseTgVoipEndpointType(JNIEnv *env, jint endpointType) {
switch (endpointType) {
case org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_INET:
return TgVoipEndpointType::Inet;
case org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_LAN:
return TgVoipEndpointType::Lan;
case org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_TCP_RELAY:
return TgVoipEndpointType::TcpRelay;
case org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_UDP_RELAY:
return TgVoipEndpointType::UdpRelay;
default:
throwNewJavaIllegalArgumentException(env, std::string("Unknown endpoint type: ").append(std::to_string(endpointType)).c_str());
return TgVoipEndpointType::UdpRelay;
}
}
void parseTgVoipEndpoint(JNIEnv *env, jobject endpoint, TgVoipEndpoint &tgVoipEndpoint) {
JavaObject endpointObject(env, endpoint);
tgVoipEndpoint.endpointId = endpointObject.getLongField("id");
tgVoipEndpoint.host = jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4"));
tgVoipEndpoint.port = static_cast<uint16_t>(endpointObject.getIntField("port"));
tgVoipEndpoint.type = parseTgVoipEndpointType(env, endpointObject.getIntField("type"));
jbyteArray peerTag = endpointObject.getByteArrayField("peerTag");
if (peerTag && env->GetArrayLength(peerTag)) {
jbyte *peerTagBytes = env->GetByteArrayElements(peerTag, nullptr);
memcpy(tgVoipEndpoint.peerTag, peerTagBytes, 16);
env->ReleaseByteArrayElements(peerTag, peerTagBytes, JNI_ABORT);
}
}
void parseTgVoipEndpoints(JNIEnv *env, jobjectArray endpoints, std::vector<TgVoipEndpoint> &tgVoipEndpoints) {
for (int i = 0, size = env->GetArrayLength(endpoints); i < size; i++) {
TgVoipEndpoint tgVoipEndpoint;
parseTgVoipEndpoint(env, env->GetObjectArrayElement(endpoints, i), tgVoipEndpoint);
tgVoipEndpoints.push_back(tgVoipEndpoint);
}
}
void parseTgVoipEncryptionKey(JNIEnv *env, jobject encryptionKey, TgVoipEncryptionKey &tgVoipEncryptionKey) {
JavaObject encryptionKeyObject(env, encryptionKey);
tgVoipEncryptionKey.isOutgoing = encryptionKeyObject.getBooleanField("isOutgoing") == JNI_TRUE;
jbyteArray valueByteArray = encryptionKeyObject.getByteArrayField("value");
auto *valueBytes = (uint8_t *) env->GetByteArrayElements(valueByteArray, nullptr);
tgVoipEncryptionKey.value = std::vector<uint8_t>(valueBytes, valueBytes + env->GetArrayLength(valueByteArray));
env->ReleaseByteArrayElements(valueByteArray, (jbyte *) valueBytes, JNI_ABORT);
}
void parseTgVoipProxy(JNIEnv *env, jobject proxy, std::unique_ptr<TgVoipProxy> &tgVoipProxy) {
if (!env->IsSameObject(proxy, nullptr)) {
JavaObject proxyObject(env, proxy);
tgVoipProxy = std::unique_ptr<TgVoipProxy>(new TgVoipProxy);
tgVoipProxy->host = jni::JavaStringToStdString(env, proxyObject.getStringField("host"));
tgVoipProxy->port = static_cast<uint16_t>(proxyObject.getIntField("port"));
tgVoipProxy->login = jni::JavaStringToStdString(env, proxyObject.getStringField("login"));
tgVoipProxy->password = jni::JavaStringToStdString(env, proxyObject.getStringField("password"));
} else {
tgVoipProxy = nullptr;
}
}
jint asJavaState(const TgVoipState &tgVoipState) {
switch (tgVoipState) {
case TgVoipState::WaitInit:
return org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT;
case TgVoipState::WaitInitAck:
return org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT_ACK;
case TgVoipState::Estabilished:
return org_telegram_messenger_voip_TgVoip_STATE_ESTABLISHED;
case TgVoipState::Failed:
return org_telegram_messenger_voip_TgVoip_STATE_FAILED;
case TgVoipState::Reconnecting:
return org_telegram_messenger_voip_TgVoip_STATE_RECONNECTING;
}
}
jobject asJavaTrafficStats(JNIEnv *env, const TgVoipTrafficStats &trafficStats) {
jclass clazz = env->FindClass("org/telegram/messenger/voip/TgVoip$TrafficStats");
jmethodID initMethodId = env->GetMethodID(clazz, "<init>", "(JJJJ)V");
return env->NewObject(clazz, initMethodId, trafficStats.bytesSentWifi, trafficStats.bytesReceivedWifi, trafficStats.bytesSentMobile, trafficStats.bytesReceivedMobile);
}
jobject asJavaFinalState(JNIEnv *env, const TgVoipFinalState &tgVoipFinalState) {
jbyteArray persistentState = copyVectorToJavaByteArray(env, tgVoipFinalState.persistentState.value);
jstring debugLog = env->NewStringUTF(tgVoipFinalState.debugLog.c_str());
jobject trafficStats = asJavaTrafficStats(env, tgVoipFinalState.trafficStats);
auto isRatingSuggested = static_cast<jboolean>(tgVoipFinalState.isRatingSuggested);
jclass finalStateClass = env->FindClass("org/telegram/messenger/voip/TgVoip$FinalState");
jmethodID finalStateInitMethodId = env->GetMethodID(finalStateClass, "<init>", "([BLjava/lang/String;Lorg/telegram/messenger/voip/TgVoip$TrafficStats;Z)V");
return env->NewObject(finalStateClass, finalStateInitMethodId, persistentState, debugLog, trafficStats, isRatingSuggested);
}
extern "C" {
#pragma mark - Static JNI Methods
JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeTgVoipDelegate_makeNativeInstance(JNIEnv *env, jobject obj, jobject instanceObj, jobject config, jstring persistentStateFilePath, jobjectArray endpoints, jobject proxy, jint networkType, jobject encryptionKey) {
// reading persistent state
TgVoipPersistentState tgVoipPersistentState;
readTgVoipPersistentState(jni::JavaStringToStdString(env, persistentStateFilePath).c_str(), tgVoipPersistentState);
// parsing config
TgVoipConfig tgVoipConfig;
parseTgVoipConfig(env, config, tgVoipConfig);
// parsing endpoints
std::vector<TgVoipEndpoint> tgVoipEndpoints;
parseTgVoipEndpoints(env, endpoints, tgVoipEndpoints);
// parsing proxy
std::unique_ptr<TgVoipProxy> tgVoipProxy;
parseTgVoipProxy(env, proxy, tgVoipProxy);
// parse encryption key
TgVoipEncryptionKey tgVoipEncryptionKey;
parseTgVoipEncryptionKey(env, encryptionKey, tgVoipEncryptionKey);
TgVoip *tgVoip = TgVoip::makeInstance(tgVoipConfig, tgVoipPersistentState, tgVoipEndpoints, tgVoipProxy, parseTgVoipNetworkType(networkType), tgVoipEncryptionKey);
if (env->ExceptionCheck() == JNI_TRUE) {
return 0;
}
jobject globalRef = env->NewGlobalRef(instanceObj);
tgVoip->setOnStateUpdated([globalRef](TgVoipState tgVoipState) {
jint state = asJavaState(tgVoipState);
jni::DoWithJNI([globalRef, state](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onStateUpdated", "(I)V"), state);
});
});
tgVoip->setOnSignalBarsUpdated([globalRef](int signalBars) {
jni::DoWithJNI([globalRef, signalBars](JNIEnv *env) {
env->CallVoidMethod(globalRef, env->GetMethodID(env->GetObjectClass(globalRef), "onSignalBarsUpdated", "(I)V"), signalBars);
});
});
auto *instance = new InstanceHolder;
instance->nativeInstance = tgVoip;
instance->javaInstance = globalRef;
return reinterpret_cast<jlong>(instance);
}
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipDelegate_setGlobalServerConfig(JNIEnv *env, jobject obj, jstring serverConfigJson) {
TgVoip::setGlobalServerConfig(jni::JavaStringToStdString(env, serverConfigJson));
}
JNIEXPORT jint JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipDelegate_getConnectionMaxLayer(JNIEnv *env, jobject obj) {
return TgVoip::getConnectionMaxLayer();
}
JNIEXPORT jstring JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipDelegate_getVersion(JNIEnv *env, jobject obj) {
return env->NewStringUTF(TgVoip::getVersion().c_str());
}
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipDelegate_setBufferSize(JNIEnv *env, jobject obj, jint size) {
tgvoip::audio::AudioOutputOpenSLES::nativeBufferSize = (unsigned int) size;
tgvoip::audio::AudioInputOpenSLES::nativeBufferSize = (unsigned int) size;
}
#pragma mark - Virtual JNI Methods
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_setNetworkType(JNIEnv *env, jobject obj, jint networkType) {
getTgVoip(env, obj)->setNetworkType(parseTgVoipNetworkType(networkType));
}
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_setMuteMicrophone(JNIEnv *env, jobject obj, jboolean muteMicrophone) {
getTgVoip(env, obj)->setMuteMicrophone(muteMicrophone);
}
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_setAudioOutputGainControlEnabled(JNIEnv *env, jobject obj, jboolean enabled) {
getTgVoip(env, obj)->setAudioOutputGainControlEnabled(enabled);
}
JNIEXPORT void JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_setEchoCancellationStrength(JNIEnv *env, jobject obj, jint strength) {
getTgVoip(env, obj)->setEchoCancellationStrength(strength);
}
JNIEXPORT jstring JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_getLastError(JNIEnv *env, jobject obj) {
return env->NewStringUTF(getTgVoip(env, obj)->getLastError().c_str());
}
JNIEXPORT jstring JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_getDebugInfo(JNIEnv *env, jobject obj) {
return env->NewStringUTF(getTgVoip(env, obj)->getDebugInfo().c_str());
}
JNIEXPORT jlong JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_getPreferredRelayId(JNIEnv *env, jobject obj) {
return getTgVoip(env, obj)->getPreferredRelayId();
}
JNIEXPORT jobject JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_getTrafficStats(JNIEnv *env, jobject obj) {
return asJavaTrafficStats(env, getTgVoip(env, obj)->getTrafficStats());
}
JNIEXPORT jbyteArray JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_getPersistentState(JNIEnv *env, jobject obj) {
return copyVectorToJavaByteArray(env, getTgVoip(env, obj)->getPersistentState().value);
}
JNIEXPORT jobject JNICALL
Java_org_telegram_messenger_voip_NativeTgVoipInstance_stop(JNIEnv *env, jobject obj) {
InstanceHolder *instance = getInstanceHolder(env, obj);
TgVoipFinalState tgVoipFinalState = instance->nativeInstance->stop();
// saving persistent state
const std::string &path = jni::JavaStringToStdString(env, JavaObject(env, obj).getStringField("persistentStateFilePath"));
saveTgVoipPersistentState(path.c_str(), tgVoipFinalState.persistentState);
// clean
env->DeleteGlobalRef(instance->javaInstance);
delete instance->nativeInstance;
delete instance;
return asJavaFinalState(env, tgVoipFinalState);
}
}

View File

@ -1,63 +0,0 @@
#include <jni.h>
#ifndef _Included_org_telegram_messenger_voip_TgVoip
#define _Included_org_telegram_messenger_voip_TgVoip
#ifdef __cplusplus
extern "C" {
#endif
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_UNKNOWN
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_UNKNOWN 0L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_GPRS
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_GPRS 1L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_EDGE
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_EDGE 2L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_3G
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_3G 3L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_HSPA
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_HSPA 4L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_LTE
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_LTE 5L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_WIFI
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_WIFI 6L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_ETHERNET
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_ETHERNET 7L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_HIGH_SPEED
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_HIGH_SPEED 8L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_LOW_SPEED
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_LOW_SPEED 9L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_DIALUP
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_DIALUP 10L
#undef org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_MOBILE
#define org_telegram_messenger_voip_TgVoip_NET_TYPE_OTHER_MOBILE 11L
#undef org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_INET
#define org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_INET 0L
#undef org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_LAN
#define org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_LAN 1L
#undef org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_UDP_RELAY
#define org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_UDP_RELAY 2L
#undef org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_TCP_RELAY
#define org_telegram_messenger_voip_TgVoip_ENDPOINT_TYPE_TCP_RELAY 3L
#undef org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT
#define org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT 1L
#undef org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT_ACK
#define org_telegram_messenger_voip_TgVoip_STATE_WAIT_INIT_ACK 2L
#undef org_telegram_messenger_voip_TgVoip_STATE_ESTABLISHED
#define org_telegram_messenger_voip_TgVoip_STATE_ESTABLISHED 3L
#undef org_telegram_messenger_voip_TgVoip_STATE_FAILED
#define org_telegram_messenger_voip_TgVoip_STATE_FAILED 4L
#undef org_telegram_messenger_voip_TgVoip_STATE_RECONNECTING
#define org_telegram_messenger_voip_TgVoip_STATE_RECONNECTING 5L
#undef org_telegram_messenger_voip_TgVoip_DATA_SAVING_NEVER
#define org_telegram_messenger_voip_TgVoip_DATA_SAVING_NEVER 0L
#undef org_telegram_messenger_voip_TgVoip_DATA_SAVING_MOBILE
#define org_telegram_messenger_voip_TgVoip_DATA_SAVING_MOBILE 1L
#undef org_telegram_messenger_voip_TgVoip_DATA_SAVING_ALWAYS
#define org_telegram_messenger_voip_TgVoip_DATA_SAVING_ALWAYS 2L
#undef org_telegram_messenger_voip_TgVoip_DATA_SAVING_ROAMING
#define org_telegram_messenger_voip_TgVoip_DATA_SAVING_ROAMING 3L
#undef org_telegram_messenger_voip_TgVoip_PEER_CAP_GROUP_CALLS
#define org_telegram_messenger_voip_TgVoip_PEER_CAP_GROUP_CALLS 1L
#ifdef __cplusplus
}
#endif
#endif

View File

@ -15,8 +15,6 @@
#include "../../os/android/AudioInputOpenSLES.h"
#include "../../os/android/AudioInputAndroid.h"
#include "../../os/android/AudioOutputAndroid.h"
#include "../../os/android/VideoSourceAndroid.h"
#include "../../os/android/VideoRendererAndroid.h"
#include "../../audio/Resampler.h"
#include "../../os/android/JNIUtilities.h"
#include "../../PrivateDefines.h"
@ -34,9 +32,6 @@ jmethodID setStateMethod=NULL;
jmethodID setSignalBarsMethod=NULL;
jmethodID setSelfStreamsMethod=NULL;
jmethodID setParticipantAudioEnabledMethod=NULL;
jmethodID groupCallKeyReceivedMethod=NULL;
jmethodID groupCallKeySentMethod=NULL;
jmethodID callUpgradeRequestReceivedMethod=NULL;
jclass jniUtilitiesClass=NULL;
struct ImplDataAndroid{
@ -48,217 +43,90 @@ struct ImplDataAndroid{
#define TGVOIP_PACKAGE_PATH "org/telegram/messenger/voip"
#endif
#ifndef TGVOIP_PEER_TAG_VARIABLE_NAME
#define TGVOIP_PEER_TAG_VARIABLE_NAME "peer_tag"
#endif
#ifndef TGVOIP_ENDPOINT_CLASS
#define TGVOIP_ENDPOINT_CLASS "org/telegram/tgnet/TLRPC$TL_phoneConnection"
#endif
using namespace tgvoip;
using namespace tgvoip::audio;
namespace tgvoip {
#pragma mark - Callbacks
void updateConnectionState(VoIPController *cntrlr, int state){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
void updateConnectionState(VoIPController *cntrlr, int state) {
ImplDataAndroid *impl = (ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(setStateMethod, impl->javaObject, state);
}
void updateSignalBarCount(VoIPController *cntrlr, int count){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
void updateSignalBarCount(VoIPController *cntrlr, int count) {
ImplDataAndroid *impl = (ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(setSignalBarsMethod, impl->javaObject, count);
}
void updateGroupCallStreams(VoIPGroupController *cntrlr, unsigned char *streams, size_t len){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
if(!impl->javaObject)
return;
jni::DoWithJNI([streams, len, &impl](JNIEnv* env){
if(setSelfStreamsMethod){
jbyteArray jstreams=env->NewByteArray(static_cast<jsize>(len));
jbyte *el=env->GetByteArrayElements(jstreams, NULL);
memcpy(el, streams, len);
env->ReleaseByteArrayElements(jstreams, el, 0);
env->CallVoidMethod(impl->javaObject, setSelfStreamsMethod, jstreams);
}
});
}
void groupCallKeyReceived(VoIPController *cntrlr, const unsigned char *key){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
if(!impl->javaObject)
return;
jni::DoWithJNI([key, &impl](JNIEnv* env){
if(groupCallKeyReceivedMethod){
jbyteArray jkey=env->NewByteArray(256);
jbyte *el=env->GetByteArrayElements(jkey, NULL);
memcpy(el, key, 256);
env->ReleaseByteArrayElements(jkey, el, 0);
env->CallVoidMethod(impl->javaObject, groupCallKeyReceivedMethod, jkey);
}
});
}
void groupCallKeySent(VoIPController *cntrlr){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(groupCallKeySentMethod, impl->javaObject);
}
void callUpgradeRequestReceived(VoIPController* cntrlr){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(callUpgradeRequestReceivedMethod, impl->javaObject);
}
void updateParticipantAudioState(VoIPGroupController *cntrlr, int32_t userID, bool enabled){
ImplDataAndroid *impl=(ImplDataAndroid *) cntrlr->implData;
jni::AttachAndCallVoidMethod(setParticipantAudioEnabledMethod, impl->javaObject, userID, enabled);
}
#pragma mark - VoIPController
uint32_t AndroidCodecToFOURCC(std::string mime){
if(mime=="video/avc")
return CODEC_AVC;
else if(mime=="video/hevc")
return CODEC_HEVC;
else if(mime=="video/x-vnd.on2.vp8")
return CODEC_VP8;
else if(mime=="video/x-vnd.on2.vp9")
return CODEC_VP9;
return 0;
}
jlong VoIPController_nativeInit(JNIEnv* env, jobject thiz, jstring persistentStateFile) {
ImplDataAndroid* impl=new ImplDataAndroid();
impl->javaObject=env->NewGlobalRef(thiz);
if(persistentStateFile){
impl->persistentStateFile=jni::JavaStringToStdString(env, persistentStateFile);
jlong VoIPController_nativeInit(JNIEnv *env, jobject thiz, jstring persistentStateFile) {
ImplDataAndroid *impl = new ImplDataAndroid();
impl->javaObject = env->NewGlobalRef(thiz);
if (persistentStateFile) {
impl->persistentStateFile = jni::JavaStringToStdString(env, persistentStateFile);
}
VoIPController* cntrlr=new VoIPController();
cntrlr->implData=impl;
VoIPController *cntrlr = new VoIPController();
cntrlr->implData = impl;
VoIPController::Callbacks callbacks;
callbacks.connectionStateChanged=updateConnectionState;
callbacks.signalBarCountChanged=updateSignalBarCount;
callbacks.groupCallKeyReceived=groupCallKeyReceived;
callbacks.groupCallKeySent=groupCallKeySent;
callbacks.upgradeToGroupCallRequested=callUpgradeRequestReceived;
callbacks.connectionStateChanged = updateConnectionState;
callbacks.signalBarCountChanged = updateSignalBarCount;
cntrlr->SetCallbacks(callbacks);
if(!impl->persistentStateFile.empty()){
FILE* f=fopen(impl->persistentStateFile.c_str(), "r");
if(f){
if (!impl->persistentStateFile.empty()) {
FILE *f = fopen(impl->persistentStateFile.c_str(), "r");
if (f) {
fseek(f, 0, SEEK_END);
size_t len=static_cast<size_t>(ftell(f));
size_t len = static_cast<size_t>(ftell(f));
fseek(f, 0, SEEK_SET);
if(len<1024*512 && len>0){
char *fbuf=static_cast<char *>(malloc(len));
if (len < 1024 * 512 && len > 0) {
char *fbuf = static_cast<char *>(malloc(len));
fread(fbuf, 1, len, f);
std::vector<uint8_t> state(fbuf, fbuf+len);
std::vector<uint8_t> state(fbuf, fbuf + len);
free(fbuf);
cntrlr->SetPersistentState(state);
}
fclose(f);
}
}
/*if(video::VideoRendererAndroid::availableDecoders.empty() || video::VideoSourceAndroid::availableEncoders.empty()){
video::VideoRendererAndroid::availableDecoders.clear();
video::VideoSourceAndroid::availableEncoders.clear();
jmethodID getCodecsMethod=env->GetStaticMethodID(jniUtilitiesClass, "getSupportedVideoCodecs", "()[[Ljava/lang/String;");
jobjectArray codecs=static_cast<jobjectArray>(env->CallStaticObjectMethod(jniUtilitiesClass, getCodecsMethod));
jobjectArray encoders=static_cast<jobjectArray>(env->GetObjectArrayElement(codecs, 0));
jobjectArray decoders=static_cast<jobjectArray>(env->GetObjectArrayElement(codecs, 1));
for(jsize i=0;i<env->GetArrayLength(encoders);i++){
std::string codec=jni::JavaStringToStdString(env, static_cast<jstring>(env->GetObjectArrayElement(encoders, i)));
uint32_t id=AndroidCodecToFOURCC(codec);
if(id)
video::VideoSourceAndroid::availableEncoders.push_back(id);
}
for(jsize i=0;i<env->GetArrayLength(decoders);i++){
std::string codec=jni::JavaStringToStdString(env, static_cast<jstring>(env->GetObjectArrayElement(decoders, i)));
uint32_t id=AndroidCodecToFOURCC(codec);
if(id)
video::VideoRendererAndroid::availableDecoders.push_back(id);
}
jmethodID getMaxResolutionMethod=env->GetStaticMethodID(jniUtilitiesClass, "getMaxVideoResolution", "()I");
video::VideoRendererAndroid::maxResolution=env->CallStaticIntMethod(jniUtilitiesClass, getMaxResolutionMethod);
}*/
return (jlong)(intptr_t)cntrlr;
return (jlong) (intptr_t) cntrlr;
}
void VoIPController_nativeStart(JNIEnv* env, jobject thiz, jlong inst){
((VoIPController*)(intptr_t)inst)->Start();
void VoIPController_nativeStart(JNIEnv *env, jobject thiz, jlong inst) {
((VoIPController *) (intptr_t) inst)->Start();
}
void VoIPController_nativeConnect(JNIEnv* env, jobject thiz, jlong inst){
((VoIPController*)(intptr_t)inst)->Connect();
void VoIPController_nativeConnect(JNIEnv *env, jobject thiz, jlong inst) {
((VoIPController *) (intptr_t) inst)->Connect();
}
void VoIPController_nativeSetProxy(JNIEnv* env, jobject thiz, jlong inst, jstring _address, jint port, jstring _username, jstring _password){
((VoIPController*)(intptr_t)inst)->SetProxy(PROXY_SOCKS5, jni::JavaStringToStdString(env, _address), (uint16_t)port, jni::JavaStringToStdString(env, _username), jni::JavaStringToStdString(env, _password));
void VoIPController_nativeSetProxy(JNIEnv *env, jobject thiz, jlong inst, jstring _address, jint port, jstring _username, jstring _password) {
((VoIPController *) (intptr_t) inst)->SetProxy(PROXY_SOCKS5, jni::JavaStringToStdString(env, _address), (uint16_t) port, jni::JavaStringToStdString(env, _username), jni::JavaStringToStdString(env, _password));
}
void VoIPController_nativeSetEncryptionKey(JNIEnv* env, jobject thiz, jlong inst, jbyteArray key, jboolean isOutgoing){
jbyte* akey=env->GetByteArrayElements(key, NULL);
((VoIPController*)(intptr_t)inst)->SetEncryptionKey((char *) akey, isOutgoing);
void VoIPController_nativeSetEncryptionKey(JNIEnv *env, jobject thiz, jlong inst, jbyteArray key, jboolean isOutgoing) {
jbyte *akey = env->GetByteArrayElements(key, NULL);
((VoIPController *) (intptr_t) inst)->SetEncryptionKey((char *) akey, isOutgoing);
env->ReleaseByteArrayElements(key, akey, JNI_ABORT);
}
void VoIPController_nativeSetRemoteEndpoints(JNIEnv* env, jobject thiz, jlong inst, jobjectArray endpoints, jboolean allowP2p, jboolean tcp, jint connectionMaxLayer){
size_t len=(size_t) env->GetArrayLength(endpoints);
std::vector<Endpoint> eps;
/*public String ip;
public String ipv6;
public int port;
public byte[] peer_tag;*/
jclass epClass=env->GetObjectClass(env->GetObjectArrayElement(endpoints, 0));
jfieldID ipFld=env->GetFieldID(epClass, "ip", "Ljava/lang/String;");
jfieldID ipv6Fld=env->GetFieldID(epClass, "ipv6", "Ljava/lang/String;");
jfieldID portFld=env->GetFieldID(epClass, "port", "I");
jfieldID peerTagFld=env->GetFieldID(epClass, TGVOIP_PEER_TAG_VARIABLE_NAME, "[B");
jfieldID idFld=env->GetFieldID(epClass, "id", "J");
int i;
for(i=0;i<len;i++){
jobject endpoint=env->GetObjectArrayElement(endpoints, i);
jstring ip=(jstring) env->GetObjectField(endpoint, ipFld);
jstring ipv6=(jstring) env->GetObjectField(endpoint, ipv6Fld);
jint port=env->GetIntField(endpoint, portFld);
jlong id=env->GetLongField(endpoint, idFld);
jbyteArray peerTag=(jbyteArray) env->GetObjectField(endpoint, peerTagFld);
IPv4Address v4addr(jni::JavaStringToStdString(env, ip));
IPv6Address v6addr("::0");
if(ipv6 && env->GetStringLength(ipv6)){
v6addr=IPv6Address(jni::JavaStringToStdString(env, ipv6));
}
unsigned char pTag[16];
if(peerTag && env->GetArrayLength(peerTag)){
jbyte* peerTagBytes=env->GetByteArrayElements(peerTag, NULL);
memcpy(pTag, peerTagBytes, 16);
env->ReleaseByteArrayElements(peerTag, peerTagBytes, JNI_ABORT);
}
eps.push_back(Endpoint((int64_t)id, (uint16_t)port, v4addr, v6addr, tcp ? Endpoint::Type::TCP_RELAY : Endpoint::Type::UDP_RELAY, pTag));
}
((VoIPController*)(intptr_t)inst)->SetRemoteEndpoints(eps, allowP2p, connectionMaxLayer);
void VoIPController_nativeSetNativeBufferSize(JNIEnv *env, jclass thiz, jint size) {
AudioOutputOpenSLES::nativeBufferSize = (unsigned int) size;
AudioInputOpenSLES::nativeBufferSize = (unsigned int) size;
}
void VoIPController_nativeSetNativeBufferSize(JNIEnv* env, jclass thiz, jint size){
AudioOutputOpenSLES::nativeBufferSize=(unsigned int) size;
AudioInputOpenSLES::nativeBufferSize=(unsigned int) size;
}
void VoIPController_nativeRelease(JNIEnv* env, jobject thiz, jlong inst){
void VoIPController_nativeRelease(JNIEnv *env, jobject thiz, jlong inst) {
//env->DeleteGlobalRef(AudioInputAndroid::jniClass);
VoIPController* ctlr=((VoIPController*)(intptr_t)inst);
ImplDataAndroid* impl=(ImplDataAndroid*)ctlr->implData;
VoIPController *ctlr = ((VoIPController *) (intptr_t) inst);
ImplDataAndroid *impl = (ImplDataAndroid *) ctlr->implData;
ctlr->Stop();
std::vector<uint8_t> state=ctlr->GetPersistentState();
std::vector<uint8_t> state = ctlr->GetPersistentState();
delete ctlr;
env->DeleteGlobalRef(impl->javaObject);
if(!impl->persistentStateFile.empty()){
FILE* f=fopen(impl->persistentStateFile.c_str(), "w");
if(f){
if (!impl->persistentStateFile.empty()) {
FILE *f = fopen(impl->persistentStateFile.c_str(), "w");
if (f) {
fwrite(state.data(), 1, state.size(), f);
fclose(f);
}
@ -266,280 +134,120 @@ namespace tgvoip {
delete impl;
}
jstring VoIPController_nativeGetDebugString(JNIEnv* env, jobject thiz, jlong inst){
std::string str=((VoIPController*)(intptr_t)inst)->GetDebugString();
jstring VoIPController_nativeGetDebugString(JNIEnv *env, jobject thiz, jlong inst) {
std::string str = ((VoIPController *) (intptr_t) inst)->GetDebugString();
return env->NewStringUTF(str.c_str());
}
void VoIPController_nativeSetNetworkType(JNIEnv* env, jobject thiz, jlong inst, jint type){
((VoIPController*)(intptr_t)inst)->SetNetworkType(type);
void VoIPController_nativeSetNetworkType(JNIEnv *env, jobject thiz, jlong inst, jint type) {
((VoIPController *) (intptr_t) inst)->SetNetworkType(type);
}
void VoIPController_nativeSetMicMute(JNIEnv* env, jobject thiz, jlong inst, jboolean mute){
((VoIPController*)(intptr_t)inst)->SetMicMute(mute);
void VoIPController_nativeSetMicMute(JNIEnv *env, jobject thiz, jlong inst, jboolean mute) {
((VoIPController *) (intptr_t) inst)->SetMicMute(mute);
}
void VoIPController_nativeSetConfig(JNIEnv* env, jobject thiz, jlong inst, jdouble recvTimeout, jdouble initTimeout, jint dataSavingMode, jboolean enableAEC, jboolean enableNS, jboolean enableAGC, jstring logFilePath, jstring statsDumpPath, jboolean logPacketStats){
void VoIPController_nativeSetConfig(JNIEnv *env, jobject thiz, jlong inst, jdouble recvTimeout, jdouble initTimeout, jint dataSavingMode, jboolean enableAEC, jboolean enableNS, jboolean enableAGC, jstring logFilePath, jstring statsDumpPath, jboolean logPacketStats) {
VoIPController::Config cfg;
cfg.initTimeout=initTimeout;
cfg.recvTimeout=recvTimeout;
cfg.dataSaving=dataSavingMode;
cfg.enableAEC=enableAEC;
cfg.enableNS=enableNS;
cfg.enableAGC=enableAGC;
cfg.enableCallUpgrade=false;
cfg.logPacketStats=logPacketStats;
if(logFilePath){
cfg.logFilePath=jni::JavaStringToStdString(env, logFilePath);
cfg.initTimeout = initTimeout;
cfg.recvTimeout = recvTimeout;
cfg.dataSaving = dataSavingMode;
cfg.enableAEC = enableAEC;
cfg.enableNS = enableNS;
cfg.enableAGC = enableAGC;
cfg.enableCallUpgrade = false;
cfg.logPacketStats = logPacketStats;
if (logFilePath) {
cfg.logFilePath = jni::JavaStringToStdString(env, logFilePath);
}
if(statsDumpPath){
cfg.statsDumpFilePath=jni::JavaStringToStdString(env, statsDumpPath);
if (statsDumpPath) {
cfg.statsDumpFilePath = jni::JavaStringToStdString(env, statsDumpPath);
}
((VoIPController*)(intptr_t)inst)->SetConfig(cfg);
((VoIPController *) (intptr_t) inst)->SetConfig(cfg);
}
void VoIPController_nativeDebugCtl(JNIEnv* env, jobject thiz, jlong inst, jint request, jint param){
((VoIPController*)(intptr_t)inst)->DebugCtl(request, param);
void VoIPController_nativeDebugCtl(JNIEnv *env, jobject thiz, jlong inst, jint request, jint param) {
((VoIPController *) (intptr_t) inst)->DebugCtl(request, param);
}
jstring VoIPController_nativeGetVersion(JNIEnv* env, jclass clasz){
jstring VoIPController_nativeGetVersion(JNIEnv *env, jclass clasz) {
return env->NewStringUTF(VoIPController::GetVersion());
}
jlong VoIPController_nativeGetPreferredRelayID(JNIEnv* env, jclass clasz, jlong inst){
return ((VoIPController*)(intptr_t)inst)->GetPreferredRelayID();
jlong VoIPController_nativeGetPreferredRelayID(JNIEnv *env, jclass clasz, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetPreferredRelayID();
}
jint VoIPController_nativeGetLastError(JNIEnv* env, jclass clasz, jlong inst){
return ((VoIPController*)(intptr_t)inst)->GetLastError();
jint VoIPController_nativeGetLastError(JNIEnv *env, jclass clasz, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetLastError();
}
void VoIPController_nativeGetStats(JNIEnv* env, jclass clasz, jlong inst, jobject stats){
void VoIPController_nativeGetStats(JNIEnv *env, jclass clasz, jlong inst, jobject stats) {
VoIPController::TrafficStats _stats;
((VoIPController*)(intptr_t)inst)->GetStats(&_stats);
jclass cls=env->GetObjectClass(stats);
((VoIPController *) (intptr_t) inst)->GetStats(&_stats);
jclass cls = env->GetObjectClass(stats);
env->SetLongField(stats, env->GetFieldID(cls, "bytesSentWifi", "J"), _stats.bytesSentWifi);
env->SetLongField(stats, env->GetFieldID(cls, "bytesSentMobile", "J"), _stats.bytesSentMobile);
env->SetLongField(stats, env->GetFieldID(cls, "bytesRecvdWifi", "J"), _stats.bytesRecvdWifi);
env->SetLongField(stats, env->GetFieldID(cls, "bytesRecvdMobile", "J"), _stats.bytesRecvdMobile);
}
jstring VoIPController_nativeGetDebugLog(JNIEnv* env, jobject thiz, jlong inst){
VoIPController* ctlr=((VoIPController*)(intptr_t)inst);
std::string log=ctlr->GetDebugLog();
jstring VoIPController_nativeGetDebugLog(JNIEnv *env, jobject thiz, jlong inst) {
VoIPController *ctlr = ((VoIPController *) (intptr_t) inst);
std::string log = ctlr->GetDebugLog();
return env->NewStringUTF(log.c_str());
}
void VoIPController_nativeSetAudioOutputGainControlEnabled(JNIEnv* env, jclass clasz, jlong inst, jboolean enabled){
((VoIPController*)(intptr_t)inst)->SetAudioOutputGainControlEnabled(enabled);
void VoIPController_nativeSetAudioOutputGainControlEnabled(JNIEnv *env, jclass clasz, jlong inst, jboolean enabled) {
((VoIPController *) (intptr_t) inst)->SetAudioOutputGainControlEnabled(enabled);
}
void VoIPController_nativeSetEchoCancellationStrength(JNIEnv* env, jclass cls, jlong inst, jint strength){
((VoIPController*)(intptr_t)inst)->SetEchoCancellationStrength(strength);
void VoIPController_nativeSetEchoCancellationStrength(JNIEnv *env, jclass cls, jlong inst, jint strength) {
((VoIPController *) (intptr_t) inst)->SetEchoCancellationStrength(strength);
}
jint VoIPController_nativeGetPeerCapabilities(JNIEnv* env, jclass cls, jlong inst){
return ((VoIPController*)(intptr_t)inst)->GetPeerCapabilities();
jint VoIPController_nativeGetPeerCapabilities(JNIEnv *env, jclass cls, jlong inst) {
return ((VoIPController *) (intptr_t) inst)->GetPeerCapabilities();
}
void VoIPController_nativeSendGroupCallKey(JNIEnv* env, jclass cls, jlong inst, jbyteArray _key){
jbyte* key=env->GetByteArrayElements(_key, NULL);
((VoIPController*)(intptr_t)inst)->SendGroupCallKey((unsigned char *) key);
env->ReleaseByteArrayElements(_key, key, JNI_ABORT);
jboolean VoIPController_nativeNeedRate(JNIEnv *env, jclass cls, jlong inst) {
return static_cast<jboolean>(((VoIPController *) (intptr_t) inst)->NeedRate());
}
void VoIPController_nativeRequestCallUpgrade(JNIEnv* env, jclass cls, jlong inst){
((VoIPController*)(intptr_t)inst)->RequestCallUpgrade();
}
void VoIPController_nativeSetVideoSource(JNIEnv* env, jobject thiz, jlong inst, jlong source){
((VoIPController*)(intptr_t)inst)->SetVideoSource((video::VideoSource*)(intptr_t)source);
}
void VoIPController_nativeSetVideoRenderer(JNIEnv* env, jobject thiz, jlong inst, jlong renderer){
((VoIPController*)(intptr_t)inst)->SetVideoRenderer((video::VideoRenderer*)(intptr_t)renderer);
}
jboolean VoIPController_nativeNeedRate(JNIEnv* env, jclass cls, jlong inst){
return static_cast<jboolean>(((VoIPController*)(intptr_t)inst)->NeedRate());
}
jint VoIPController_getConnectionMaxLayer(JNIEnv* env, jclass cls){
jint VoIPController_getConnectionMaxLayer(JNIEnv *env, jclass cls) {
return VoIPController::GetConnectionMaxLayer();
}
#pragma mark - AudioRecordJNI
void AudioRecordJNI_nativeCallback(JNIEnv* env, jobject thiz, jobject buffer){
jlong inst=env->GetLongField(thiz, audioRecordInstanceFld);
AudioInputAndroid* in=(AudioInputAndroid*)(intptr_t)inst;
void AudioRecordJNI_nativeCallback(JNIEnv *env, jobject thiz, jobject buffer) {
jlong inst = env->GetLongField(thiz, audioRecordInstanceFld);
AudioInputAndroid *in = (AudioInputAndroid *) (intptr_t) inst;
in->HandleCallback(env, buffer);
}
#pragma mark - AudioTrackJNI
void AudioTrackJNI_nativeCallback(JNIEnv* env, jobject thiz, jbyteArray buffer){
jlong inst=env->GetLongField(thiz, audioTrackInstanceFld);
AudioOutputAndroid* in=(AudioOutputAndroid*)(intptr_t)inst;
void AudioTrackJNI_nativeCallback(JNIEnv *env, jobject thiz, jbyteArray buffer) {
jlong inst = env->GetLongField(thiz, audioTrackInstanceFld);
AudioOutputAndroid *in = (AudioOutputAndroid *) (intptr_t) inst;
in->HandleCallback(env, buffer);
}
#pragma mark - VoIPServerConfig
void VoIPServerConfig_nativeSetConfig(JNIEnv* env, jclass clasz, jstring jsonString){
void VoIPServerConfig_nativeSetConfig(JNIEnv *env, jclass clasz, jstring jsonString) {
ServerConfig::GetSharedInstance()->Update(jni::JavaStringToStdString(env, jsonString));
}
#pragma mark - Resampler
jint Resampler_convert44to48(JNIEnv* env, jclass cls, jobject from, jobject to){
return (jint)tgvoip::audio::Resampler::Convert44To48((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from)/2), (size_t) (env->GetDirectBufferCapacity(to)/2));
jint Resampler_convert44to48(JNIEnv *env, jclass cls, jobject from, jobject to) {
return (jint) tgvoip::audio::Resampler::Convert44To48((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from) / 2), (size_t) (env->GetDirectBufferCapacity(to) / 2));
}
jint Resampler_convert48to44(JNIEnv* env, jclass cls, jobject from, jobject to){
return (jint)tgvoip::audio::Resampler::Convert48To44((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from)/2), (size_t) (env->GetDirectBufferCapacity(to)/2));
jint Resampler_convert48to44(JNIEnv *env, jclass cls, jobject from, jobject to) {
return (jint) tgvoip::audio::Resampler::Convert48To44((int16_t *) env->GetDirectBufferAddress(from), (int16_t *) env->GetDirectBufferAddress(to), (size_t) (env->GetDirectBufferCapacity(from) / 2), (size_t) (env->GetDirectBufferCapacity(to) / 2));
}
#pragma mark - VoIPGroupController
#ifndef TGVOIP_NO_GROUP_CALLS
jlong VoIPGroupController_nativeInit(JNIEnv* env, jobject thiz, jint timeDifference){
ImplDataAndroid* impl=(ImplDataAndroid*) malloc(sizeof(ImplDataAndroid));
impl->javaObject=env->NewGlobalRef(thiz);
VoIPGroupController* cntrlr=new VoIPGroupController(timeDifference);
cntrlr->implData=impl;
VoIPGroupController::Callbacks callbacks;
callbacks.connectionStateChanged=updateConnectionState;
callbacks.updateStreams=updateGroupCallStreams;
callbacks.participantAudioStateChanged=updateParticipantAudioState;
callbacks.signalBarCountChanged=NULL;
cntrlr->SetCallbacks(callbacks);
return (jlong)(intptr_t)cntrlr;
}
void VoIPGroupController_nativeSetGroupCallInfo(JNIEnv* env, jclass cls, jlong inst, jbyteArray _encryptionKey, jbyteArray _reflectorGroupTag, jbyteArray _reflectorSelfTag, jbyteArray _reflectorSelfSecret, jbyteArray _reflectorSelfTagHash, jint selfUserID, jstring reflectorAddress, jstring reflectorAddressV6, jint reflectorPort){
VoIPGroupController* ctlr=((VoIPGroupController*)(intptr_t)inst);
jbyte* encryptionKey=env->GetByteArrayElements(_encryptionKey, NULL);
jbyte* reflectorGroupTag=env->GetByteArrayElements(_reflectorGroupTag, NULL);
jbyte* reflectorSelfTag=env->GetByteArrayElements(_reflectorSelfTag, NULL);
jbyte* reflectorSelfSecret=env->GetByteArrayElements(_reflectorSelfSecret, NULL);
jbyte* reflectorSelfTagHash=env->GetByteArrayElements(_reflectorSelfTagHash, NULL);
const char* ipChars=env->GetStringUTFChars(reflectorAddress, NULL);
std::string ipLiteral(ipChars);
IPv4Address v4addr(ipLiteral);
IPv6Address v6addr("::0");
env->ReleaseStringUTFChars(reflectorAddress, ipChars);
if(reflectorAddressV6 && env->GetStringLength(reflectorAddressV6)){
const char* ipv6Chars=env->GetStringUTFChars(reflectorAddressV6, NULL);
v6addr=IPv6Address(ipv6Chars);
env->ReleaseStringUTFChars(reflectorAddressV6, ipv6Chars);
}
ctlr->SetGroupCallInfo((unsigned char *) encryptionKey, (unsigned char *) reflectorGroupTag, (unsigned char *) reflectorSelfTag, (unsigned char *) reflectorSelfSecret, (unsigned char*) reflectorSelfTagHash, selfUserID, v4addr, v6addr, (uint16_t)reflectorPort);
env->ReleaseByteArrayElements(_encryptionKey, encryptionKey, JNI_ABORT);
env->ReleaseByteArrayElements(_reflectorGroupTag, reflectorGroupTag, JNI_ABORT);
env->ReleaseByteArrayElements(_reflectorSelfTag, reflectorSelfTag, JNI_ABORT);
env->ReleaseByteArrayElements(_reflectorSelfSecret, reflectorSelfSecret, JNI_ABORT);
env->ReleaseByteArrayElements(_reflectorSelfTagHash, reflectorSelfTagHash, JNI_ABORT);
}
void VoIPGroupController_nativeAddGroupCallParticipant(JNIEnv* env, jclass cls, jlong inst, jint userID, jbyteArray _memberTagHash, jbyteArray _streams){
VoIPGroupController* ctlr=((VoIPGroupController*)(intptr_t)inst);
jbyte* memberTagHash=env->GetByteArrayElements(_memberTagHash, NULL);
jbyte* streams=_streams ? env->GetByteArrayElements(_streams, NULL) : NULL;
ctlr->AddGroupCallParticipant(userID, (unsigned char *) memberTagHash, (unsigned char *) streams, (size_t) env->GetArrayLength(_streams));
env->ReleaseByteArrayElements(_memberTagHash, memberTagHash, JNI_ABORT);
if(_streams)
env->ReleaseByteArrayElements(_streams, streams, JNI_ABORT);
}
void VoIPGroupController_nativeRemoveGroupCallParticipant(JNIEnv* env, jclass cls, jlong inst, jint userID){
VoIPGroupController* ctlr=((VoIPGroupController*)(intptr_t)inst);
ctlr->RemoveGroupCallParticipant(userID);
}
jfloat VoIPGroupController_nativeGetParticipantAudioLevel(JNIEnv* env, jclass cls, jlong inst, jint userID){
return ((VoIPGroupController*)(intptr_t)inst)->GetParticipantAudioLevel(userID);
}
void VoIPGroupController_nativeSetParticipantVolume(JNIEnv* env, jclass cls, jlong inst, jint userID, jfloat volume){
((VoIPGroupController*)(intptr_t)inst)->SetParticipantVolume(userID, volume);
}
jbyteArray VoIPGroupController_getInitialStreams(JNIEnv* env, jclass cls){
unsigned char buf[1024];
size_t len=VoIPGroupController::GetInitialStreams(buf, sizeof(buf));
jbyteArray arr=env->NewByteArray(len);
jbyte* arrElems=env->GetByteArrayElements(arr, NULL);
memcpy(arrElems, buf, len);
env->ReleaseByteArrayElements(arr, arrElems, 0);
return arr;
}
void VoIPGroupController_nativeSetParticipantStreams(JNIEnv* env, jclass cls, jlong inst, jint userID, jbyteArray _streams){
jbyte* streams=env->GetByteArrayElements(_streams, NULL);
((VoIPGroupController*)(intptr_t)inst)->SetParticipantStreams(userID, (unsigned char *) streams, (size_t) env->GetArrayLength(_streams));
env->ReleaseByteArrayElements(_streams, streams, JNI_ABORT);
}
#endif
#pragma mark - VideoSource
jlong VideoSource_nativeInit(JNIEnv* env, jobject thiz){
return (jlong)(intptr_t)new video::VideoSourceAndroid(env->NewGlobalRef(thiz));
}
void VideoSource_nativeRelease(JNIEnv* env, jobject thiz, jlong inst){
delete (video::VideoSource*)(intptr_t)inst;
}
void VideoSource_nativeSetVideoStreamParameters(JNIEnv* env, jobject thiz, jlong inst, jobjectArray _csd, jint width, jint height){
std::vector<Buffer> csd;
if(_csd){
for(int i=0; i<env->GetArrayLength(_csd); i++){
jobject _buf=env->GetObjectArrayElement(_csd, i);
size_t len=static_cast<size_t>(env->GetDirectBufferCapacity(_buf));
Buffer buf(len);
buf.CopyFrom(env->GetDirectBufferAddress(_buf), 0, len);
csd.push_back(std::move(buf));
}
}
((video::VideoSourceAndroid*)(intptr_t)inst)->SetStreamParameters(std::move(csd), width, height);
}
void VideoSource_nativeSendFrame(JNIEnv* env, jobject thiz, jlong inst, jobject buffer, jint offset, jint length, jint flags){
size_t bufsize=(size_t)env->GetDirectBufferCapacity(buffer);
Buffer buf(static_cast<size_t>(length));
buf.CopyFrom(((char*)env->GetDirectBufferAddress(buffer))+offset, 0, static_cast<size_t>(length));
((video::VideoSourceAndroid*)(intptr_t)inst)->SendFrame(std::move(buf), static_cast<uint32_t>(flags));
}
void VideoSource_nativeSetRotation(JNIEnv* env, jobject thiz, jlong inst, jint rotation){
((video::VideoSourceAndroid*)(intptr_t)inst)->SetRotation((unsigned int)rotation);
}
#pragma mark - VideoRenderer
jlong VideoRenderer_nativeInit(JNIEnv* env, jobject thiz){
return (jlong)(intptr_t)new video::VideoRendererAndroid(env->NewGlobalRef(thiz));
}
#pragma mark - VLog
template<int level> void VLog_log(JNIEnv* env, jclass cls, jstring jmsg){
const char* format="[java] %s";
std::string msg=jni::JavaStringToStdString(env, jmsg);
switch(level){
template<int level>
void VLog_log(JNIEnv *env, jclass cls, jstring jmsg) {
const char *format = "[java] %s";
std::string msg = jni::JavaStringToStdString(env, jmsg);
switch (level) {
case 0:
LOGV(format, msg.c_str());
break;
@ -550,7 +258,7 @@ namespace tgvoip {
LOGI(format, msg.c_str());
break;
case 3:
LOGW(format, msg.c_str());
LOGW(format, msg.c_str());
break;
case 4:
LOGE(format, msg.c_str());
@ -561,189 +269,117 @@ namespace tgvoip {
}
}
extern "C" int tgvoipOnJniLoad(JavaVM *vm, JNIEnv *env);
extern "C" {
int tgvoipOnJNILoad(JavaVM *vm, JNIEnv *env) {
jclass controller = env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPController");
if (env->ExceptionCheck()) {
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass audioRecordJNI = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
jclass audioTrackJNI = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
jclass serverConfig = env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPServerConfig");
jclass resampler = env->FindClass(TGVOIP_PACKAGE_PATH "/Resampler");
if (env->ExceptionCheck()) {
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass vlog = env->FindClass(TGVOIP_PACKAGE_PATH "/VLog");
if (env->ExceptionCheck()) {
env->ExceptionClear();
}
assert(controller && audioRecordJNI && audioTrackJNI && serverConfig && resampler);
extern "C" jint JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *env = 0;
srand(time(NULL));
audioRecordInstanceFld = env->GetFieldID(audioRecordJNI, "nativeInst", "J");
audioTrackInstanceFld = env->GetFieldID(audioTrackJNI, "nativeInst", "J");
if (vm->GetEnv((void **) &env, JNI_VERSION_1_6) != JNI_OK) {
return -1;
}
env->GetJavaVM(&sharedJVM);
if (!AudioInputAndroid::jniClass) {
jclass cls = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
AudioInputAndroid::jniClass = (jclass) env->NewGlobalRef(cls);
AudioInputAndroid::initMethod = env->GetMethodID(cls, "init", "(IIII)V");
AudioInputAndroid::releaseMethod = env->GetMethodID(cls, "release", "()V");
AudioInputAndroid::startMethod = env->GetMethodID(cls, "start", "()Z");
AudioInputAndroid::stopMethod = env->GetMethodID(cls, "stop", "()V");
AudioInputAndroid::getEnabledEffectsMaskMethod = env->GetMethodID(cls, "getEnabledEffectsMask", "()I");
if (tgvoipOnJniLoad(vm, env) != JNI_TRUE) {
return -1;
}
cls = env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
AudioOutputAndroid::jniClass = (jclass) env->NewGlobalRef(cls);
AudioOutputAndroid::initMethod = env->GetMethodID(cls, "init", "(IIII)V");
AudioOutputAndroid::releaseMethod = env->GetMethodID(cls, "release", "()V");
AudioOutputAndroid::startMethod = env->GetMethodID(cls, "start", "()V");
AudioOutputAndroid::stopMethod = env->GetMethodID(cls, "stop", "()V");
}
jclass controller=env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPController");
jclass groupController=env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPGroupController");
if(env->ExceptionCheck()){
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass audioRecordJNI=env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
jclass audioTrackJNI=env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
jclass serverConfig=env->FindClass(TGVOIP_PACKAGE_PATH "/VoIPServerConfig");
jclass resampler=env->FindClass(TGVOIP_PACKAGE_PATH "/Resampler");
jclass videoSource=env->FindClass(TGVOIP_PACKAGE_PATH "/VideoSource");
if(env->ExceptionCheck()){
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass videoRenderer=env->FindClass(TGVOIP_PACKAGE_PATH "/VideoRenderer");
if(env->ExceptionCheck()){
env->ExceptionClear(); // is returning NULL from FindClass not enough?
}
jclass vlog=env->FindClass(TGVOIP_PACKAGE_PATH "/VLog");
if(env->ExceptionCheck()){
env->ExceptionClear();
}
assert(controller && audioRecordJNI && audioTrackJNI && serverConfig && resampler);
setStateMethod = env->GetMethodID(controller, "handleStateChange", "(I)V");
setSignalBarsMethod = env->GetMethodID(controller, "handleSignalBarsChange", "(I)V");
audioRecordInstanceFld=env->GetFieldID(audioRecordJNI, "nativeInst", "J");
audioTrackInstanceFld=env->GetFieldID(audioTrackJNI, "nativeInst", "J");
if (!jniUtilitiesClass) {
jniUtilitiesClass = (jclass) env->NewGlobalRef(env->FindClass(TGVOIP_PACKAGE_PATH "/JNIUtilities"));
}
env->GetJavaVM(&sharedJVM);
if(!AudioInputAndroid::jniClass){
jclass cls=env->FindClass(TGVOIP_PACKAGE_PATH "/AudioRecordJNI");
AudioInputAndroid::jniClass=(jclass) env->NewGlobalRef(cls);
AudioInputAndroid::initMethod=env->GetMethodID(cls, "init", "(IIII)V");
AudioInputAndroid::releaseMethod=env->GetMethodID(cls, "release", "()V");
AudioInputAndroid::startMethod=env->GetMethodID(cls, "start", "()Z");
AudioInputAndroid::stopMethod=env->GetMethodID(cls, "stop", "()V");
AudioInputAndroid::getEnabledEffectsMaskMethod=env->GetMethodID(cls, "getEnabledEffectsMask", "()I");
// VoIPController
JNINativeMethod controllerMethods[] = {
{"nativeInit", "(Ljava/lang/String;)J", (void *) &tgvoip::VoIPController_nativeInit},
{"nativeStart", "(J)V", (void *) &tgvoip::VoIPController_nativeStart},
{"nativeConnect", "(J)V", (void *) &tgvoip::VoIPController_nativeConnect},
{"nativeSetProxy", "(JLjava/lang/String;ILjava/lang/String;Ljava/lang/String;)V", (void *) &tgvoip::VoIPController_nativeSetProxy},
{"nativeSetEncryptionKey", "(J[BZ)V", (void *) &tgvoip::VoIPController_nativeSetEncryptionKey},
{"nativeSetNativeBufferSize", "(I)V", (void *) &tgvoip::VoIPController_nativeSetNativeBufferSize},
{"nativeRelease", "(J)V", (void *) &tgvoip::VoIPController_nativeRelease},
{"nativeGetDebugString", "(J)Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetDebugString},
{"nativeSetNetworkType", "(JI)V", (void *) &tgvoip::VoIPController_nativeSetNetworkType},
{"nativeSetMicMute", "(JZ)V", (void *) &tgvoip::VoIPController_nativeSetMicMute},
{"nativeSetConfig", "(JDDIZZZLjava/lang/String;Ljava/lang/String;Z)V", (void *) &tgvoip::VoIPController_nativeSetConfig},
{"nativeDebugCtl", "(JII)V", (void *) &tgvoip::VoIPController_nativeDebugCtl},
{"nativeGetVersion", "()Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetVersion},
{"nativeGetPreferredRelayID", "(J)J", (void *) &tgvoip::VoIPController_nativeGetPreferredRelayID},
{"nativeGetLastError", "(J)I", (void *) &tgvoip::VoIPController_nativeGetLastError},
{"nativeGetStats", "(JL" TGVOIP_PACKAGE_PATH "/VoIPController$Stats;)V", (void *) &tgvoip::VoIPController_nativeGetStats},
{"nativeGetDebugLog", "(J)Ljava/lang/String;", (void *) &tgvoip::VoIPController_nativeGetDebugLog},
{"nativeSetAudioOutputGainControlEnabled", "(JZ)V", (void *) &tgvoip::VoIPController_nativeSetAudioOutputGainControlEnabled},
{"nativeSetEchoCancellationStrength", "(JI)V", (void *) &tgvoip::VoIPController_nativeSetEchoCancellationStrength},
{"nativeGetPeerCapabilities", "(J)I", (void *) &tgvoip::VoIPController_nativeGetPeerCapabilities},
{"nativeNeedRate", "(J)Z", (void *) &tgvoip::VoIPController_nativeNeedRate},
{"getConnectionMaxLayer", "()I", (void *) &tgvoip::VoIPController_getConnectionMaxLayer}
};
env->RegisterNatives(controller, controllerMethods, sizeof(controllerMethods) / sizeof(JNINativeMethod));
cls=env->FindClass(TGVOIP_PACKAGE_PATH "/AudioTrackJNI");
AudioOutputAndroid::jniClass=(jclass) env->NewGlobalRef(cls);
AudioOutputAndroid::initMethod=env->GetMethodID(cls, "init", "(IIII)V");
AudioOutputAndroid::releaseMethod=env->GetMethodID(cls, "release", "()V");
AudioOutputAndroid::startMethod=env->GetMethodID(cls, "start", "()V");
AudioOutputAndroid::stopMethod=env->GetMethodID(cls, "stop", "()V");
// AudioRecordJNI
JNINativeMethod audioRecordMethods[] = {
{"nativeCallback", "(Ljava/nio/ByteBuffer;)V", (void *) &tgvoip::AudioRecordJNI_nativeCallback}
};
env->RegisterNatives(audioRecordJNI, audioRecordMethods, sizeof(audioRecordMethods) / sizeof(JNINativeMethod));
if(videoRenderer){
video::VideoRendererAndroid::decodeAndDisplayMethod=env->GetMethodID(videoRenderer, "decodeAndDisplay", "(Ljava/nio/ByteBuffer;IJ)V");
video::VideoRendererAndroid::resetMethod=env->GetMethodID(videoRenderer, "reset", "(Ljava/lang/String;II[[B)V");
video::VideoRendererAndroid::setStreamEnabledMethod=env->GetMethodID(videoRenderer, "setStreamEnabled", "(Z)V");
video::VideoRendererAndroid::setRotationMethod=env->GetMethodID(videoRenderer, "setRotation", "(I)V");
}
}
// AudioTrackJNI
JNINativeMethod audioTrackMethods[] = {
{"nativeCallback", "([B)V", (void *) &tgvoip::AudioTrackJNI_nativeCallback}
};
env->RegisterNatives(audioTrackJNI, audioTrackMethods, sizeof(audioTrackMethods) / sizeof(JNINativeMethod));
setStateMethod=env->GetMethodID(controller, "handleStateChange", "(I)V");
setSignalBarsMethod=env->GetMethodID(controller, "handleSignalBarsChange", "(I)V");
groupCallKeyReceivedMethod=env->GetMethodID(controller, "groupCallKeyReceived", "([B)V");
groupCallKeySentMethod=env->GetMethodID(controller, "groupCallKeySent", "()V");
callUpgradeRequestReceivedMethod=env->GetMethodID(controller, "callUpgradeRequestReceived", "()V");
// VoIPServerConfig
JNINativeMethod serverConfigMethods[] = {
{"nativeSetConfig", "(Ljava/lang/String;)V", (void *) &tgvoip::VoIPServerConfig_nativeSetConfig}
};
env->RegisterNatives(serverConfig, serverConfigMethods, sizeof(serverConfigMethods) / sizeof(JNINativeMethod));
if(!jniUtilitiesClass)
jniUtilitiesClass=(jclass) env->NewGlobalRef(env->FindClass(TGVOIP_PACKAGE_PATH "/JNIUtilities"));
// Resampler
JNINativeMethod resamplerMethods[] = {
{"convert44to48", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void *) &tgvoip::Resampler_convert44to48},
{"convert48to44", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void *) &tgvoip::Resampler_convert48to44}
};
env->RegisterNatives(resampler, resamplerMethods, sizeof(resamplerMethods) / sizeof(JNINativeMethod));
// VoIPController
JNINativeMethod controllerMethods[]={
{"nativeInit", "(Ljava/lang/String;)J", (void*)&tgvoip::VoIPController_nativeInit},
{"nativeStart", "(J)V", (void*)&tgvoip::VoIPController_nativeStart},
{"nativeConnect", "(J)V", (void*)&tgvoip::VoIPController_nativeConnect},
{"nativeSetProxy", "(JLjava/lang/String;ILjava/lang/String;Ljava/lang/String;)V", (void*)&tgvoip::VoIPController_nativeSetProxy},
{"nativeSetEncryptionKey", "(J[BZ)V", (void*)&tgvoip::VoIPController_nativeSetEncryptionKey},
{"nativeSetRemoteEndpoints", "(J[L" TGVOIP_ENDPOINT_CLASS ";ZZI)V", (void*)&tgvoip::VoIPController_nativeSetRemoteEndpoints},
{"nativeSetNativeBufferSize", "(I)V", (void*)&tgvoip::VoIPController_nativeSetNativeBufferSize},
{"nativeRelease", "(J)V", (void*)&tgvoip::VoIPController_nativeRelease},
{"nativeGetDebugString", "(J)Ljava/lang/String;", (void*)&tgvoip::VoIPController_nativeGetDebugString},
{"nativeSetNetworkType", "(JI)V", (void*)&tgvoip::VoIPController_nativeSetNetworkType},
{"nativeSetMicMute", "(JZ)V", (void*)&tgvoip::VoIPController_nativeSetMicMute},
{"nativeSetConfig", "(JDDIZZZLjava/lang/String;Ljava/lang/String;Z)V", (void*)&tgvoip::VoIPController_nativeSetConfig},
{"nativeDebugCtl", "(JII)V", (void*)&tgvoip::VoIPController_nativeDebugCtl},
{"nativeGetVersion", "()Ljava/lang/String;", (void*)&tgvoip::VoIPController_nativeGetVersion},
{"nativeGetPreferredRelayID", "(J)J", (void*)&tgvoip::VoIPController_nativeGetPreferredRelayID},
{"nativeGetLastError", "(J)I", (void*)&tgvoip::VoIPController_nativeGetLastError},
{"nativeGetStats", "(JL" TGVOIP_PACKAGE_PATH "/VoIPController$Stats;)V", (void*)&tgvoip::VoIPController_nativeGetStats},
{"nativeGetDebugLog", "(J)Ljava/lang/String;", (void*)&tgvoip::VoIPController_nativeGetDebugLog},
{"nativeSetAudioOutputGainControlEnabled", "(JZ)V", (void*)&tgvoip::VoIPController_nativeSetAudioOutputGainControlEnabled},
{"nativeSetEchoCancellationStrength", "(JI)V", (void*)&tgvoip::VoIPController_nativeSetEchoCancellationStrength},
{"nativeGetPeerCapabilities", "(J)I", (void*)&tgvoip::VoIPController_nativeGetPeerCapabilities},
{"nativeSendGroupCallKey", "(J[B)V", (void*)&tgvoip::VoIPController_nativeSendGroupCallKey},
{"nativeRequestCallUpgrade", "(J)V", (void*)&tgvoip::VoIPController_nativeRequestCallUpgrade},
{"nativeNeedRate", "(J)Z", (void*)&tgvoip::VoIPController_nativeNeedRate},
{"getConnectionMaxLayer", "()I", (void*)&tgvoip::VoIPController_getConnectionMaxLayer},
{"nativeSetVideoSource", "(JJ)V", (void*)&tgvoip::VoIPController_nativeSetVideoSource},
{"nativeSetVideoRenderer", "(JJ)V", (void*)&tgvoip::VoIPController_nativeSetVideoRenderer}
};
env->RegisterNatives(controller, controllerMethods, sizeof(controllerMethods)/sizeof(JNINativeMethod));
if (vlog) {
// VLog
JNINativeMethod vlogMethods[] = {
{"v", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<0>},
{"d", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<1>},
{"i", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<2>},
{"w", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<3>},
{"e", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<4>}
};
env->RegisterNatives(vlog, vlogMethods, sizeof(vlogMethods) / sizeof(JNINativeMethod));
}
// VoIPGroupController
#ifndef TGVOIP_NO_GROUP_CALLS
if(groupController){
setStateMethod=env->GetMethodID(groupController, "handleStateChange", "(I)V");
setParticipantAudioEnabledMethod=env->GetMethodID(groupController, "setParticipantAudioEnabled", "(IZ)V");
setSelfStreamsMethod=env->GetMethodID(groupController, "setSelfStreams", "([B)V");
JNINativeMethod groupControllerMethods[]={
{"nativeInit", "(I)J", (void*)&tgvoip::VoIPGroupController_nativeInit},
{"nativeSetGroupCallInfo", "(J[B[B[B[B[BILjava/lang/String;Ljava/lang/String;I)V", (void*)&tgvoip::VoIPGroupController_nativeSetGroupCallInfo},
{"nativeAddGroupCallParticipant", "(JI[B[B)V", (void*)&tgvoip::VoIPGroupController_nativeAddGroupCallParticipant},
{"nativeRemoveGroupCallParticipant", "(JI)V", (void*)&tgvoip::VoIPGroupController_nativeRemoveGroupCallParticipant},
{"nativeGetParticipantAudioLevel", "(JI)F", (void*)&tgvoip::VoIPGroupController_nativeGetParticipantAudioLevel},
{"nativeSetParticipantVolume", "(JIF)V", (void*)&tgvoip::VoIPGroupController_nativeSetParticipantVolume},
{"getInitialStreams", "()[B", (void*)&tgvoip::VoIPGroupController_getInitialStreams},
{"nativeSetParticipantStreams", "(JI[B)V", (void*)&tgvoip::VoIPGroupController_nativeSetParticipantStreams}
};
env->RegisterNatives(groupController, groupControllerMethods, sizeof(groupControllerMethods)/sizeof(JNINativeMethod));
}
#endif
// AudioRecordJNI
JNINativeMethod audioRecordMethods[]={
{"nativeCallback", "(Ljava/nio/ByteBuffer;)V", (void*)&tgvoip::AudioRecordJNI_nativeCallback}
};
env->RegisterNatives(audioRecordJNI, audioRecordMethods, sizeof(audioRecordMethods)/sizeof(JNINativeMethod));
// AudioTrackJNI
JNINativeMethod audioTrackMethods[]={
{"nativeCallback", "([B)V", (void*)&tgvoip::AudioTrackJNI_nativeCallback}
};
env->RegisterNatives(audioTrackJNI, audioTrackMethods, sizeof(audioTrackMethods)/sizeof(JNINativeMethod));
// VoIPServerConfig
JNINativeMethod serverConfigMethods[]={
{"nativeSetConfig", "(Ljava/lang/String;)V", (void*)&tgvoip::VoIPServerConfig_nativeSetConfig}
};
env->RegisterNatives(serverConfig, serverConfigMethods, sizeof(serverConfigMethods)/sizeof(JNINativeMethod));
// Resampler
JNINativeMethod resamplerMethods[]={
{"convert44to48", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void*)&tgvoip::Resampler_convert44to48},
{"convert48to44", "(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I", (void*)&tgvoip::Resampler_convert48to44}
};
env->RegisterNatives(resampler, resamplerMethods, sizeof(resamplerMethods)/sizeof(JNINativeMethod));
if(videoSource){
// VideoSource
JNINativeMethod videoSourceMethods[]={
{"nativeInit", "()J", (void *) &tgvoip::VideoSource_nativeInit},
{"nativeRelease", "(J)V", (void *) &tgvoip::VideoSource_nativeRelease},
{"nativeSetVideoStreamParameters", "(J[Ljava/nio/ByteBuffer;II)V", (void *) &tgvoip::VideoSource_nativeSetVideoStreamParameters},
{"nativeSendFrame", "(JLjava/nio/ByteBuffer;III)V", (void *) &tgvoip::VideoSource_nativeSendFrame},
{"nativeSetRotation", "(JI)V", (void*)&tgvoip::VideoSource_nativeSetRotation}
};
env->RegisterNatives(videoSource, videoSourceMethods, sizeof(videoSourceMethods)/sizeof(JNINativeMethod));
}
if(videoRenderer){
// VideoRenderer
JNINativeMethod videoRendererMethods[]={
{"nativeInit", "()J", (void *) &tgvoip::VideoRenderer_nativeInit}
};
env->RegisterNatives(videoRenderer, videoRendererMethods, sizeof(videoRendererMethods)/sizeof(JNINativeMethod));
}
if(vlog){
// VLog
JNINativeMethod vlogMethods[]={
{"v", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<0>},
{"d", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<1>},
{"i", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<2>},
{"w", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<3>},
{"e", "(Ljava/lang/String;)V", (void *) &tgvoip::VLog_log<4>}
};
env->RegisterNatives(vlog, vlogMethods, sizeof(vlogMethods)/sizeof(JNINativeMethod));
}
return JNI_VERSION_1_6;
return JNI_TRUE;
}
}

View File

@ -1,18 +0,0 @@
//
// Created by Grishka on 14.08.2018.
//
#ifndef TELEGRAM_TG_VOIP_JNI_H
#define TELEGRAM_TG_VOIP_JNI_H
#include <jni.h>
#ifdef __cplusplus
extern "C"{
#endif
void tgvoipRegisterNatives(JNIEnv* env);
#ifdef __cplusplus
}
#endif
#endif //TELEGRAM_TG_VOIP_JNI_H

View File

@ -1,348 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -1,265 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H
/* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `opus' library (-lopus). */
#undef HAVE_LIBOPUS
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if the system has the type `ptrdiff_t'. */
#undef HAVE_PTRDIFF_T
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the `sqrt' function. */
#undef HAVE_SQRT
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strncasecmp' function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to disable ALSA support */
#undef WITHOUT_ALSA
/* Define to disable PulseAudio support */
#undef WITHOUT_PULSE
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT8_T
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
#undef int16_t
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef int32_t
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef int64_t
/* Define to the type of a signed integer type of width exactly 8 bits if such
a type exists and the standard includes do not define it. */
#undef int8_t
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
#undef uint16_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
#undef uint8_t

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,113 +0,0 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([libtgvoip], [2.4.4], [https://github.com/grishka/libtgvoip/issues])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([subdir-objects])
AM_SILENT_RULES([yes])
LT_INIT
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_OBJCXX
AM_PROG_AS
AC_PROG_RANLIB
# Checks for libraries.
AC_CHECK_LIB([crypto], [SHA1], [], [AC_MSG_FAILURE([libssl-dev is required but not found])])
AC_CHECK_LIB([m], [floorf])
AC_CHECK_LIB([opus], [opus_decoder_create], [], [AC_MSG_FAILURE([libopus-dev is required but not found])])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CANONICAL_HOST
AS_CASE([$host_cpu],
[i?86], [cpu_x86=yes],
[x86_64], [cpu_x86=yes],
[arm*], [cpu_arm=yes],
[AS_ECHO("!! WARNING: libtgvoip wasn't tested with your CPU architecture ($host_cpu)")]
)
AS_CASE([$host_cpu],
[armv7*], [cpu_armv7=yes]
)
AS_ECHO("Detected CPU: $host_cpu")
AM_CONDITIONAL(TARGET_CPU_X86, test "x$cpu_x86" == xyes)
AM_CONDITIONAL(TARGET_CPU_ARM, test "x$cpu_arm" == xyes)
AM_CONDITIONAL(TARGET_CPU_ARMV7, test "x$cpu_armv7" == xyes)
AS_ECHO("Detected OS: $host_os")
AS_CASE([$host_os],
[darwin*], [os_osx=yes]
)
AM_CONDITIONAL(TARGET_OS_OSX, test "x$os_osx" == xyes)
AC_ARG_ENABLE([audio-callback], [AS_HELP_STRING([--enable-audio-callback], [enable callback-based audio I/O])], [], [enable_audio_callback=no])
AM_CONDITIONAL(ENABLE_AUDIO_CALLBACK, test "x$enable_audio_callback" == xyes)
AS_IF([test "x$os_osx" != xyes && test "x$enable_audio_callback" != xyes], [ # Linux
AC_CHECK_LIB([dl], [dlopen])
AC_ARG_WITH([pulse], [AS_HELP_STRING([--without-pulse], [disable PulseAudio support])], [], [with_pulse=yes])
AC_ARG_WITH([alsa], [AS_HELP_STRING([--without-alsa], [disable ALSA support])], [], [with_alsa=yes])
AS_IF([test "x$with_pulse" == xno && test "x$with_alsa" == xno], [
AC_MSG_FAILURE([You can only disable either ALSA or PulseAudio, not both]);
])
AS_IF([test "x$with_pulse" != xno], [
AC_CHECK_LIB([pulse], [pa_context_new], [
AS_ECHO_N( ) # what is the proper way to check for a library without linking it?
], [
AC_MSG_FAILURE([libpulse-dev is required during build, but you don't have it installed. Use --without-pulse to disable PulseAudio support.])
])
], [
AC_DEFINE([WITHOUT_PULSE], [1], [Define to disable PulseAudio support])
])
AS_IF([test "x$with_alsa" != xno], [
AC_CHECK_LIB([asound], [snd_pcm_open], [
AS_ECHO_N( ) # what is the proper way to check for a library without linking it?
], [
AC_MSG_FAILURE([libasound-dev is required during build, but you don't have it installed. Use --without-alsa to disable ALSA support.])
])
], [
AC_DEFINE([WITHOUT_ALSA], [1], [Define to disable ALSA support])
])
]);
AM_CONDITIONAL(WITH_PULSE, test "x$with_pulse" == xyes)
AM_CONDITIONAL(WITH_ALSA, test "x$with_alsa" == xyes)
AC_ARG_ENABLE([dsp], [AS_HELP_STRING([--disable-dsp], [disable signal processing (echo cancellation, noise suppression, and automatic gain control)])], [], [enable_dsp=yes])
AM_CONDITIONAL(ENABLE_DSP, test "x$enable_dsp" == xyes)
# Checks for header files.
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([arpa/inet.h float.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([clock_gettime floor gettimeofday inet_ntoa memmove memset select socket sqrt strcasecmp strchr strerror strncasecmp strstr strtol strtoul uname])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -1,791 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,518 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
# Note that $RANDOM variable is not portable (e.g. dash); Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p' feature.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,423 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{21f10158-c078-4bd7-a82a-9c4aeb8e2f8e}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<ProjectName>libtgvoip</ProjectName>
<RootNamespace>libtgvoip</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Phone Silverlight</ApplicationType>
<ApplicationTypeRevision>8.1</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;TGVOIP_WP_SILVERLIGHT;_CRT_SECURE_NO_WARNINGS;NOMINMAX;WEBRTC_APM_DEBUG_DUMP=0;TGVOIP_USE_CUSTOM_CRYPTO;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>webrtc_dsp;../TelegramClient/TelegramClient.Opus/opus/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalDependencies>ws2_32.lib;phoneaudioses.lib;../TelegramClient/$(Platform)/$(Configuration)/TelegramClient.Opus/TelegramClient.Opus.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;TGVOIP_WP_SILVERLIGHT;NDEBUG;_CRT_SECURE_NO_WARNINGS;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>webrtc_dsp;../TelegramClient/TelegramClient.Opus/opus/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalDependencies>ws2_32.lib;phoneaudioses.lib;../TelegramClient/$(Platform)/$(Configuration)/TelegramClient.Opus/TelegramClient.Opus.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;TGVOIP_WP_SILVERLIGHT;_CRT_SECURE_NO_WARNINGS;NOMINMAX;WEBRTC_APM_DEBUG_DUMP=0;TGVOIP_USE_CUSTOM_CRYPTO;noexcept=;_ALLOW_KEYWORD_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>webrtc_dsp;../TelegramClient/TelegramClient.Opus/opus/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalDependencies>ws2_32.lib;phoneaudioses.lib;../TelegramClient/$(Platform)/$(Configuration)/TelegramClient.Opus/TelegramClient.Opus.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_WINRT_DLL;TGVOIP_WP_SILVERLIGHT;NDEBUG;_CRT_SECURE_NO_WARNINGS;NOMINMAX;WEBRTC_APM_DEBUG_DUMP=0;TGVOIP_USE_CUSTOM_CRYPTO;noexcept=;_ALLOW_KEYWORD_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>webrtc_dsp;../TelegramClient/TelegramClient.Opus/opus/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<AdditionalDependencies>ws2_32.lib;phoneaudioses.lib;../TelegramClient/$(Platform)/$(Configuration)/TelegramClient.Opus/TelegramClient.Opus.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="audio\AudioInput.h" />
<ClInclude Include="audio\AudioIO.h" />
<ClInclude Include="audio\AudioOutput.h" />
<ClInclude Include="audio\Resampler.h" />
<ClInclude Include="BlockingQueue.h" />
<ClInclude Include="Buffers.h" />
<ClInclude Include="CongestionControl.h" />
<ClInclude Include="EchoCanceller.h" />
<ClInclude Include="JitterBuffer.h" />
<ClInclude Include="logging.h" />
<ClInclude Include="MediaStreamItf.h" />
<ClInclude Include="MessageThread.h" />
<ClInclude Include="NetworkSocket.h" />
<ClInclude Include="OpusDecoder.h" />
<ClInclude Include="OpusEncoder.h" />
<ClInclude Include="os\windows\AudioInputWASAPI.h" />
<ClInclude Include="os\windows\AudioOutputWASAPI.h" />
<ClInclude Include="os\windows\NetworkSocketWinsock.h" />
<ClInclude Include="os\windows\WindowsSandboxUtils.h" />
<ClInclude Include="PacketReassembler.h" />
<ClInclude Include="threading.h" />
<ClInclude Include="VoIPController.h" />
<ClInclude Include="os\windows\CXWrapper.h" />
<ClInclude Include="VoIPServerConfig.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\array_view.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\atomicops.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\basictypes.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\checks.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\constructormagic.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\safe_compare.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\safe_conversions.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\safe_conversions_impl.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\sanitizer.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\stringutils.h" />
<ClInclude Include="webrtc_dsp\webrtc\base\type_traits.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\channel_buffer.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\fft4g.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\include\audio_util.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\ring_buffer.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_fft_tables.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\real_fft.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\signal_processing_library.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl_armv7.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl_mips.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2_internal.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\sparse_fir_filter.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\wav_file.h" />
<ClInclude Include="webrtc_dsp\webrtc\common_audio\wav_header.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_defines.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\echo_control_mobile.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_common.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_optimized_methods.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_resampler.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\echo_cancellation.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\analog_agc.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\digital_agc.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\gain_control.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\logging\apm_data_dumper.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\defines.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression_x.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_defines.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\ns_core.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\windows_private.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\splitting_filter.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\three_band_filter_bank.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\block_mean_calculator.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_internal.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_wrapper.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_tables_common.h" />
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_tables_neon_sse2.h" />
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\asm_defines.h" />
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\compile_assert_c.h" />
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\cpu_features_wrapper.h" />
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\metrics.h" />
<ClInclude Include="webrtc_dsp\webrtc\typedefs.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="audio\AudioInput.cpp" />
<ClCompile Include="audio\AudioIO.cpp" />
<ClCompile Include="audio\AudioOutput.cpp" />
<ClCompile Include="audio\Resampler.cpp" />
<ClCompile Include="BlockingQueue.cpp" />
<ClCompile Include="Buffers.cpp" />
<ClCompile Include="CongestionControl.cpp" />
<ClCompile Include="EchoCanceller.cpp" />
<ClCompile Include="JitterBuffer.cpp" />
<ClCompile Include="logging.cpp" />
<ClCompile Include="MediaStreamItf.cpp" />
<ClCompile Include="MessageThread.cpp" />
<ClCompile Include="NetworkSocket.cpp" />
<ClCompile Include="OpusDecoder.cpp" />
<ClCompile Include="OpusEncoder.cpp" />
<ClCompile Include="os\windows\AudioInputWASAPI.cpp" />
<ClCompile Include="os\windows\AudioOutputWASAPI.cpp" />
<ClCompile Include="os\windows\NetworkSocketWinsock.cpp" />
<ClCompile Include="os\windows\WindowsSandboxUtils.cpp" />
<ClCompile Include="PacketReassembler.cpp" />
<ClCompile Include="VoIPController.cpp" />
<ClCompile Include="os\windows\CXWrapper.cpp" />
<ClCompile Include="VoIPServerConfig.cpp" />
<ClCompile Include="webrtc_dsp\webrtc\base\checks.cc" />
<ClCompile Include="webrtc_dsp\webrtc\base\stringutils.cc" />
<ClCompile Include="webrtc_dsp\webrtc\common_audio\audio_util.cc" />
<ClCompile Include="webrtc_dsp\webrtc\common_audio\channel_buffer.cc" />
<ClCompile Include="webrtc_dsp\webrtc\common_audio\fft4g.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\ring_buffer.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\auto_correlation.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\auto_corr_to_refl_coef.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_bit_reverse.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_fft.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\copy_set_operations.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\cross_correlation.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\cross_correlation_neon.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\division_operations.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\dot_product_with_scale.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\downsample_fast.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\downsample_fast_neon.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\energy.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ar.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ar_fast_q12.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ma_fast_q12.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\get_hanning_window.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\get_scaling_square.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\ilbc_specific_functions.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\levinson_durbin.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\lpc_to_refl_coef.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\min_max_operations.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\min_max_operations_neon.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\randomization_functions.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\real_fft.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\refl_coef_to_lpc.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_48khz.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2_internal.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_fractional.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\splitting_filter_impl.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_init.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_inl.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_sqrt.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_sqrt_floor.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\sqrt_of_one_minus_x_squared.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\vector_scaling_operations.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\sparse_fir_filter.cc" />
<ClCompile Include="webrtc_dsp\webrtc\common_audio\wav_file.cc" />
<ClCompile Include="webrtc_dsp\webrtc\common_audio\wav_header.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core_c.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core_neon.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\echo_control_mobile.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_neon.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_sse2.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_resampler.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\echo_cancellation.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\analog_agc.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\digital_agc.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\logging\apm_data_dumper.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression_x.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core_c.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core_neon.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\ns_core.c">
<CompileAsWinRT>false</CompileAsWinRT>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\splitting_filter.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\three_band_filter_bank.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\block_mean_calculator.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_wrapper.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_neon.cc" />
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_sse2.cc" />
<ClCompile Include="webrtc_dsp\webrtc\system_wrappers\source\cpu_features.cc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,488 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resources">
<UniqueIdentifier>11199e80-17a0-460f-a780-9bfde20eb11c</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="audio">
<UniqueIdentifier>{c5b75146-c75a-4c56-aeb2-2781658d7b0a}</UniqueIdentifier>
</Filter>
<Filter Include="windows">
<UniqueIdentifier>{de1527d9-7564-4e96-9653-6e023b90d2bc}</UniqueIdentifier>
</Filter>
<Filter Include="webrtc_dsp">
<UniqueIdentifier>{3b15701a-65dd-4d52-92d4-a7b64a73b293}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="VoIPController.cpp" />
<ClCompile Include="VoIPServerConfig.cpp" />
<ClCompile Include="BlockingQueue.cpp" />
<ClCompile Include="CongestionControl.cpp" />
<ClCompile Include="EchoCanceller.cpp" />
<ClCompile Include="JitterBuffer.cpp" />
<ClCompile Include="logging.cpp" />
<ClCompile Include="MediaStreamItf.cpp" />
<ClCompile Include="NetworkSocket.cpp" />
<ClCompile Include="OpusDecoder.cpp" />
<ClCompile Include="OpusEncoder.cpp" />
<ClCompile Include="audio\AudioInput.cpp">
<Filter>audio</Filter>
</ClCompile>
<ClCompile Include="audio\AudioOutput.cpp">
<Filter>audio</Filter>
</ClCompile>
<ClCompile Include="audio\Resampler.cpp">
<Filter>audio</Filter>
</ClCompile>
<ClCompile Include="os\windows\AudioInputWASAPI.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="os\windows\AudioOutputWASAPI.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="os\windows\NetworkSocketWinsock.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="os\windows\WindowsSandboxUtils.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\base\checks.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\base\stringutils.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\audio_util.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\channel_buffer.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\fft4g.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\ring_buffer.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\auto_correlation.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\auto_corr_to_refl_coef.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_bit_reverse.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_fft.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\copy_set_operations.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\cross_correlation.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\cross_correlation_neon.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\division_operations.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\dot_product_with_scale.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\downsample_fast.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\downsample_fast_neon.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\energy.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ar.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ar_fast_q12.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\filter_ma_fast_q12.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\get_hanning_window.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\get_scaling_square.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\ilbc_specific_functions.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\levinson_durbin.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\lpc_to_refl_coef.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\min_max_operations.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\min_max_operations_neon.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\randomization_functions.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\real_fft.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\refl_coef_to_lpc.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_48khz.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2_internal.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_fractional.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\splitting_filter_impl.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_init.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_inl.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_sqrt.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\spl_sqrt_floor.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\sqrt_of_one_minus_x_squared.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\signal_processing\vector_scaling_operations.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\sparse_fir_filter.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\wav_file.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\common_audio\wav_header.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_neon.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_sse2.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_resampler.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aec\echo_cancellation.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core_c.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core_neon.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\echo_control_mobile.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\analog_agc.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\digital_agc.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\logging\apm_data_dumper.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression_x.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core_c.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core_neon.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\ns\ns_core.c">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\splitting_filter.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\three_band_filter_bank.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\block_mean_calculator.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_wrapper.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_neon.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_sse2.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="webrtc_dsp\webrtc\system_wrappers\source\cpu_features.cc">
<Filter>webrtc_dsp</Filter>
</ClCompile>
<ClCompile Include="os\windows\CXWrapper.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="Buffers.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="VoIPController.h" />
<ClInclude Include="VoIPServerConfig.h" />
<ClInclude Include="BlockingQueue.h" />
<ClInclude Include="CongestionControl.h" />
<ClInclude Include="EchoCanceller.h" />
<ClInclude Include="JitterBuffer.h" />
<ClInclude Include="logging.h" />
<ClInclude Include="MediaStreamItf.h" />
<ClInclude Include="NetworkSocket.h" />
<ClInclude Include="OpusDecoder.h" />
<ClInclude Include="OpusEncoder.h" />
<ClInclude Include="threading.h" />
<ClInclude Include="audio\AudioInput.h">
<Filter>audio</Filter>
</ClInclude>
<ClInclude Include="audio\AudioOutput.h">
<Filter>audio</Filter>
</ClInclude>
<ClInclude Include="audio\Resampler.h">
<Filter>audio</Filter>
</ClInclude>
<ClInclude Include="os\windows\AudioInputWASAPI.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="os\windows\AudioOutputWASAPI.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="os\windows\NetworkSocketWinsock.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="os\windows\WindowsSandboxUtils.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\array_view.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\atomicops.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\basictypes.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\checks.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\constructormagic.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\safe_compare.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\safe_conversions.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\safe_conversions_impl.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\sanitizer.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\stringutils.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\base\type_traits.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\channel_buffer.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\fft4g.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\include\audio_util.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\ring_buffer.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\complex_fft_tables.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\real_fft.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\signal_processing_library.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl_armv7.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\include\spl_inl_mips.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\signal_processing\resample_by_2_internal.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\sparse_fir_filter.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\wav_file.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\common_audio\wav_header.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_common.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_core_optimized_methods.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\aec_resampler.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aec\echo_cancellation.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_core.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\aecm_defines.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\aecm\echo_control_mobile.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\analog_agc.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\digital_agc.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\agc\legacy\gain_control.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\logging\apm_data_dumper.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\defines.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\noise_suppression_x.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_core.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\nsx_defines.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\ns_core.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\ns\windows_private.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\splitting_filter.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\three_band_filter_bank.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\block_mean_calculator.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_internal.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\delay_estimator_wrapper.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_tables_common.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\modules\audio_processing\utility\ooura_fft_tables_neon_sse2.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\asm_defines.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\compile_assert_c.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\cpu_features_wrapper.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\system_wrappers\include\metrics.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="webrtc_dsp\webrtc\typedefs.h">
<Filter>webrtc_dsp</Filter>
</ClInclude>
<ClInclude Include="os\windows\CXWrapper.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="Buffers.h" />
</ItemGroup>
</Project>

View File

@ -1,916 +0,0 @@
# GYP project file for TDesktop
{
'targets': [
{
'target_name': 'libtgvoip',
'type': 'static_library',
'dependencies': [],
'defines': [
'WEBRTC_APM_DEBUG_DUMP=0',
'TGVOIP_USE_DESKTOP_DSP',
'WEBRTC_NS_FLOAT',
],
'variables': {
'tgvoip_src_loc': '.',
'official_build_target%': '',
'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include',
},
'include_dirs': [
'<(tgvoip_src_loc)/webrtc_dsp',
'<(linux_path_opus_include)',
],
'direct_dependent_settings': {
'include_dirs': [
'<(tgvoip_src_loc)',
],
},
'export_dependent_settings': [],
'sources': [
'<(tgvoip_src_loc)/BlockingQueue.cpp',
'<(tgvoip_src_loc)/BlockingQueue.h',
'<(tgvoip_src_loc)/Buffers.cpp',
'<(tgvoip_src_loc)/Buffers.h',
'<(tgvoip_src_loc)/CongestionControl.cpp',
'<(tgvoip_src_loc)/CongestionControl.h',
'<(tgvoip_src_loc)/EchoCanceller.cpp',
'<(tgvoip_src_loc)/EchoCanceller.h',
'<(tgvoip_src_loc)/JitterBuffer.cpp',
'<(tgvoip_src_loc)/JitterBuffer.h',
'<(tgvoip_src_loc)/logging.cpp',
'<(tgvoip_src_loc)/logging.h',
'<(tgvoip_src_loc)/MediaStreamItf.cpp',
'<(tgvoip_src_loc)/MediaStreamItf.h',
'<(tgvoip_src_loc)/OpusDecoder.cpp',
'<(tgvoip_src_loc)/OpusDecoder.h',
'<(tgvoip_src_loc)/OpusEncoder.cpp',
'<(tgvoip_src_loc)/OpusEncoder.h',
'<(tgvoip_src_loc)/threading.h',
'<(tgvoip_src_loc)/VoIPController.cpp',
'<(tgvoip_src_loc)/VoIPGroupController.cpp',
'<(tgvoip_src_loc)/VoIPController.h',
'<(tgvoip_src_loc)/PrivateDefines.h',
'<(tgvoip_src_loc)/VoIPServerConfig.cpp',
'<(tgvoip_src_loc)/VoIPServerConfig.h',
'<(tgvoip_src_loc)/audio/AudioInput.cpp',
'<(tgvoip_src_loc)/audio/AudioInput.h',
'<(tgvoip_src_loc)/audio/AudioOutput.cpp',
'<(tgvoip_src_loc)/audio/AudioOutput.h',
'<(tgvoip_src_loc)/audio/Resampler.cpp',
'<(tgvoip_src_loc)/audio/Resampler.h',
'<(tgvoip_src_loc)/NetworkSocket.cpp',
'<(tgvoip_src_loc)/NetworkSocket.h',
'<(tgvoip_src_loc)/PacketReassembler.cpp',
'<(tgvoip_src_loc)/PacketReassembler.h',
'<(tgvoip_src_loc)/MessageThread.cpp',
'<(tgvoip_src_loc)/MessageThread.h',
'<(tgvoip_src_loc)/audio/AudioIO.cpp',
'<(tgvoip_src_loc)/audio/AudioIO.h',
'<(tgvoip_src_loc)/video/ScreamCongestionController.cpp',
'<(tgvoip_src_loc)/video/ScreamCongestionController.h',
'<(tgvoip_src_loc)/video/VideoSource.cpp',
'<(tgvoip_src_loc)/video/VideoSource.h',
'<(tgvoip_src_loc)/video/VideoRenderer.cpp',
'<(tgvoip_src_loc)/video/VideoRenderer.h',
'<(tgvoip_src_loc)/json11.cpp',
'<(tgvoip_src_loc)/json11.hpp',
# Windows
'<(tgvoip_src_loc)/os/windows/NetworkSocketWinsock.cpp',
'<(tgvoip_src_loc)/os/windows/NetworkSocketWinsock.h',
'<(tgvoip_src_loc)/os/windows/AudioInputWave.cpp',
'<(tgvoip_src_loc)/os/windows/AudioInputWave.h',
'<(tgvoip_src_loc)/os/windows/AudioOutputWave.cpp',
'<(tgvoip_src_loc)/os/windows/AudioOutputWave.h',
'<(tgvoip_src_loc)/os/windows/AudioOutputWASAPI.cpp',
'<(tgvoip_src_loc)/os/windows/AudioOutputWASAPI.h',
'<(tgvoip_src_loc)/os/windows/AudioInputWASAPI.cpp',
'<(tgvoip_src_loc)/os/windows/AudioInputWASAPI.h',
'<(tgvoip_src_loc)/os/windows/WindowsSpecific.cpp',
'<(tgvoip_src_loc)/os/windows/WindowsSpecific.h',
# macOS
'<(tgvoip_src_loc)/os/darwin/AudioInputAudioUnit.cpp',
'<(tgvoip_src_loc)/os/darwin/AudioInputAudioUnit.h',
'<(tgvoip_src_loc)/os/darwin/AudioOutputAudioUnit.cpp',
'<(tgvoip_src_loc)/os/darwin/AudioOutputAudioUnit.h',
'<(tgvoip_src_loc)/os/darwin/AudioInputAudioUnitOSX.cpp',
'<(tgvoip_src_loc)/os/darwin/AudioInputAudioUnitOSX.h',
'<(tgvoip_src_loc)/os/darwin/AudioOutputAudioUnitOSX.cpp',
'<(tgvoip_src_loc)/os/darwin/AudioOutputAudioUnitOSX.h',
'<(tgvoip_src_loc)/os/darwin/AudioUnitIO.cpp',
'<(tgvoip_src_loc)/os/darwin/AudioUnitIO.h',
'<(tgvoip_src_loc)/os/darwin/DarwinSpecific.mm',
'<(tgvoip_src_loc)/os/darwin/DarwinSpecific.h',
# Linux
'<(tgvoip_src_loc)/os/linux/AudioInputALSA.cpp',
'<(tgvoip_src_loc)/os/linux/AudioInputALSA.h',
'<(tgvoip_src_loc)/os/linux/AudioOutputALSA.cpp',
'<(tgvoip_src_loc)/os/linux/AudioOutputALSA.h',
'<(tgvoip_src_loc)/os/linux/AudioOutputPulse.cpp',
'<(tgvoip_src_loc)/os/linux/AudioOutputPulse.h',
'<(tgvoip_src_loc)/os/linux/AudioInputPulse.cpp',
'<(tgvoip_src_loc)/os/linux/AudioInputPulse.h',
'<(tgvoip_src_loc)/os/linux/AudioPulse.cpp',
'<(tgvoip_src_loc)/os/linux/AudioPulse.h',
# POSIX
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp',
'<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.h',
# WebRTC APM
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/include/field_trial.h',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/include/cpu_features_wrapper.h',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/include/asm_defines.h',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/include/metrics.h',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/include/compile_assert_c.h',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/source/field_trial.cc',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/source/metrics.cc',
'<(tgvoip_src_loc)/webrtc_dsp/system_wrappers/source/cpu_features.cc',
'<(tgvoip_src_loc)/webrtc_dsp/typedefs.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/internal/memutil.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/internal/memutil.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/string_view.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/ascii.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/ascii.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/strings/string_view.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/types/optional.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/types/bad_optional_access.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/types/bad_optional_access.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/types/optional.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/memory/memory.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/meta/type_traits.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/algorithm/algorithm.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/container/inlined_vector.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/policy_checks.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/port.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/config.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/raw_logging.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/throw_delegate.cc',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/invoke.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/inline_variable.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/atomic_hook.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/identity.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/raw_logging.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/internal/throw_delegate.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/attributes.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/macros.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/optimization.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/base/log_severity.h',
'<(tgvoip_src_loc)/webrtc_dsp/absl/utility/utility.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/string_to_number.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/constructormagic.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/race_checker.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/strings/string_builder.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/strings/string_builder.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/event_tracer.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/stringencode.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/memory/aligned_malloc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/memory/aligned_malloc.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/timeutils.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/event.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/ignore_wundef.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/stringutils.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/arraysize.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_file.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/swap_queue.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/string_to_number.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/trace_event.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/checks.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/deprecation.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/thread_checker_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/sanitizer.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/scoped_ref_ptr.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/logging.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/timeutils.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/atomicops.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/stringencode.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/stringutils.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/checks.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/numerics/safe_minmax.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/numerics/safe_conversions.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/numerics/safe_conversions_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/numerics/safe_compare.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/unused.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/inline.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/ignore_warnings.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/asm_defines.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/rtc_export.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/system/arch.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_thread.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_thread.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_thread_types.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/protobuf_utils.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/thread_annotations.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/gtest_prod_util.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/function_view.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/criticalsection.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/criticalsection.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_thread_types.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/refcount.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/event.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/thread_checker_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/event_tracer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/compile_assert_c.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/logging_webrtc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/type_traits.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/platform_file.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/refcounter.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/logging_mac.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/thread_checker.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/race_checker.h',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/refcountedobject.h',
'<(tgvoip_src_loc)/webrtc_dsp/third_party/rnnoise/src/rnn_vad_weights.cc',
'<(tgvoip_src_loc)/webrtc_dsp/third_party/rnnoise/src/rnn_activations.h',
'<(tgvoip_src_loc)/webrtc_dsp/third_party/rnnoise/src/kiss_fft.h',
'<(tgvoip_src_loc)/webrtc_dsp/third_party/rnnoise/src/kiss_fft.cc',
'<(tgvoip_src_loc)/webrtc_dsp/third_party/rnnoise/src/rnn_vad_weights.h',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/audio_frame.cc',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/echo_canceller3_config.h',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/echo_control.h',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/audio_frame.h',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/echo_canceller3_config.cc',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/echo_canceller3_factory.h',
'<(tgvoip_src_loc)/webrtc_dsp/api/audio/echo_canceller3_factory.cc',
'<(tgvoip_src_loc)/webrtc_dsp/api/array_view.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/third_party/fft/fft.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/third_party/fft/fft.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/bandwidth_info.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/include/isac.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/os_specific_inline.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filterbanks.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/entropy_coding.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_vad.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/settings.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/transform.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/crc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_filter.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filter_functions.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lattice.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/intialize.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_float_type.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/codec.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/entropy_coding.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac_vad.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/structs.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/filter_functions.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/arith_routines.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/crc.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/decode_bwe.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/isac.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/lpc_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/rms_level.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/moving_max.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/circular_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/normalized_covariance_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/normalized_covariance_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/moving_max.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/circular_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/mean_variance_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_detector/mean_variance_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_control_for_experimental_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/splitting_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_control_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/rms_level.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/ns_core.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/nsx_core.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/noise_suppression_x.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/nsx_core_c.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/defines.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/noise_suppression.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/ns_core.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/nsx_core.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/windows_private.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/noise_suppression_x.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/noise_suppression.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/nsx_defines.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/residual_echo_detector.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_processing_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/typing_detection.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/render_queue_item_verifier.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_generator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/config.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_frame_view.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/mock_audio_processing.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/gain_control.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_generator_factory.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_processing_statistics.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_generator_factory.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/aec_dump.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/aec_dump.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_processing_statistics.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_processing.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/audio_processing.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/include/config.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/interpolated_gain_curve.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/biquad_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/interpolated_gain_curve.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/agc2_common.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/agc2_testing_common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/gain_applier.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/signal_classifier.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_agc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_digital_gain_applier.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/limiter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/saturation_protector.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/vector_float_frame.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/sequence_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/rnn.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/rnn.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/test_utils.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_info.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/lp_residual.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/ring_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search_internal.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/symmetric_matrix_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/features_extraction.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/fft_util.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/spectral_features.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/pitch_search.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/features_extraction.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/fft_util.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/rnn_vad/lp_residual.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/fixed_gain_controller.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/vector_float_frame.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/down_sampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/noise_level_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/agc2_testing_common.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/fixed_digital_level_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/fixed_gain_controller.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/saturation_protector.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/vad_with_level.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/limiter_db_gain_curve.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/agc2_common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_digital_gain_applier.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/vad_with_level.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/limiter_db_gain_curve.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/fixed_digital_level_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/gain_applier.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/down_sampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/noise_level_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/signal_classifier.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/noise_spectrum_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/compute_interpolated_gain_curve.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/compute_interpolated_gain_curve.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/biquad_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/noise_spectrum_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/limiter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc2/adaptive_mode_level_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/moving_moments.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/transient_detector.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/wpd_tree.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/transient_suppressor.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/daubechies_8_wavelet_coeffs.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/wpd_node.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/moving_moments.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/wpd_tree.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/wpd_node.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/transient_suppressor.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/transient_detector.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/transient/dyadic_decimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/low_cut_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/noise_suppression_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/level_estimator_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/three_band_filter_bank.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/echo_cancellation.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_resampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_resampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/echo_cancellation.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_core.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_core.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_core_optimized_methods.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_core_sse2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/voice_detection_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/voice_detection_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_cancellation_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_control_for_experimental_agc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/agc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/loudness_histogram.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/agc_manager_direct.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/legacy/analog_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/legacy/gain_control.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/legacy/digital_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/legacy/analog_agc.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/legacy/digital_agc.c',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/utility.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/mock_agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/loudness_histogram.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/gain_map_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/utility.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/agc_manager_direct.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/agc/agc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_processing_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_control_mobile_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/splitting_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/low_cut_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_generator/file_audio_generator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/audio_generator/file_audio_generator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_controller2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/three_band_filter_bank.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/residual_echo_detector.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_cancellation_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/noise_suppression_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/level_estimator_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_controller2.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/aecm_core.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/aecm_defines.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/aecm_core.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/aecm_core_c.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/echo_control_mobile.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/echo_control_mobile.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_reverb_model.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/downsampled_render_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor_output_analyzer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model_fallback.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/residual_echo_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/shadow_filter_update_gain.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_remover_metrics.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matched_filter_lag_aggregator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec_state.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_path_variability.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/frame_blocker.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_delay_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/adaptive_fir_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/cascaded_biquad_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matched_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor_output.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_signal_analyzer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec3_fft.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec3_fft.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_remover_metrics.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/fullband_erle_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_processor.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/filter_analyzer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_path_delay_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subband_erle_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_controller_metrics.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_processor_metrics.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/vector_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/erl_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec_state.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/adaptive_fir_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/fft_data.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_controller.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/skew_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_controller_metrics.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/comfort_noise_generator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_path_delay_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/erl_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_remover.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_framer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/erle_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/cascaded_biquad_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matrix_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor_output.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/stationarity_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_signal_analyzer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_path_variability.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/moving_average.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_reverb_model.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subtractor_output_analyzer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_gain.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_audibility.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_processor_metrics.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_controller.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_gain.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/moving_average.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/erle_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/subband_erle_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec3_common.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/residual_echo_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_processor.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/fullband_erle_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matched_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/stationarity_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_canceller3.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/skew_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_decay_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_controller2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_gain_limiter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/main_filter_update_gain.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_remover.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model_fallback.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/downsampled_render_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/vector_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matrix_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_frequency_response.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_audibility.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/fft_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_processor2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/echo_canceller3.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_delay_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/aec3_common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/fft_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/vector_math.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/decimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/frame_blocker.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/block_framer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/suppression_gain_limiter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/delay_estimate.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/comfort_noise_generator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_model.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/main_filter_update_gain.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/matched_filter_lag_aggregator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/shadow_filter_update_gain.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/filter_analyzer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_decay_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/reverb_frequency_response.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/decimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec3/render_delay_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/echo_control_mobile_impl.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/gain_control_impl.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/typing_detection.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/logging/apm_data_dumper.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/logging/apm_data_dumper.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/voice_activity_detector.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/standalone_vad.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/vad_audio_proc_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pitch_internal.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/vad_circular_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/vad_circular_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pitch_based_vad.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/vad_audio_proc.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pole_zero_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pole_zero_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pitch_based_vad.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/gmm.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/vad_audio_proc.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/voice_gmm_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/noise_gmm_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/pitch_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/gmm.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/standalone_vad.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/vad/voice_activity_detector.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/delay_estimator_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/delay_estimator_wrapper.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft_sse2.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/delay_estimator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/block_mean_calculator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/block_mean_calculator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/delay_estimator.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft_tables_common.h',
'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/delay_estimator_wrapper.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/mocks/mock_smoothing_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/wav_file.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/window_generator.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/channel_buffer.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_factory.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/sparse_fir_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_sse.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/window_generator.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/ring_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/include/audio_util.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/wav_header.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/real_fourier_ooura.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/audio_util.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/real_fourier_ooura.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_sse.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/smoothing_filter.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/push_sinc_resampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinc_resampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/resampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinc_resampler_sse.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/include/push_resampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/include/resampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/push_sinc_resampler.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/push_resampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinusoidal_linear_chirp_source.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinc_resampler.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinusoidal_linear_chirp_source.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_factory.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/audio_converter.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/wav_file.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/third_party/fft4g/fft4g.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/third_party/fft4g/fft4g.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/audio_converter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/real_fourier.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/channel_buffer.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/real_fourier.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/sparse_fir_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/smoothing_filter.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_c.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/ring_buffer.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_c.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/complex_fft_tables.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/complex_fft.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/filter_ma_fast_q12.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/levinson_durbin.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/dot_product_with_scale.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/auto_corr_to_refl_coef.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample_by_2_internal.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/energy.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/sqrt_of_one_minus_x_squared.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/downsample_fast.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/splitting_filter1.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/spl_init.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/lpc_to_refl_coef.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/cross_correlation.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/include/signal_processing_library.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/include/real_fft.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/include/spl_inl.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/division_operations.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/auto_correlation.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/get_scaling_square.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/dot_product_with_scale.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample_by_2_internal.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/min_max_operations.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/refl_coef_to_lpc.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/filter_ar.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/vector_scaling_operations.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample_fractional.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/real_fft.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/ilbc_specific_functions.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/complex_bit_reverse.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/randomization_functions.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/copy_set_operations.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample_by_2.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/get_hanning_window.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/resample_48khz.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/spl_inl.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/spl_sqrt.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/wav_header.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_sp.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad.cc',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/webrtc_vad.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_core.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/include/vad.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/include/webrtc_vad.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_gmm.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_filterbank.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_core.c',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_sp.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_filterbank.h',
'<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_gmm.c',
# ARM/NEON sources
# TODO check if there's a good way to make these compile with ARM ports of TDesktop
#'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/ns/nsx_core_neon.c',
#'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aec/aec_core_neon.cc',
#'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/aecm/aecm_core_neon.cc',
#'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft_tables_neon_sse2.h',
#'<(tgvoip_src_loc)/webrtc_dsp/modules/audio_processing/utility/ooura_fft_neon.cc',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_neon.cc',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/resampler/sinc_resampler_neon.cc',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_arm.S',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/fir_filter_neon.h',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/downsample_fast_neon.c',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/complex_bit_reverse_arm.S',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/include/spl_inl_armv7.h',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/min_max_operations_neon.c',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/cross_correlation_neon.c',
#'<(tgvoip_src_loc)/webrtc_dsp/common_audio/signal_processing/filter_ar_fast_q12_armv7.S',
],
'libraries': [],
'configurations': {
'Debug': {},
'Release': {},
},
'conditions': [
[
'"<(OS)" != "win"', {
'sources/': [['exclude', '<(tgvoip_src_loc)/os/windows/']],
}, {
'sources/': [['exclude', '<(tgvoip_src_loc)/os/posix/']],
},
],
[
'"<(OS)" != "mac"', {
'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']],
},
],
[
'"<(OS)" != "linux"', {
'sources/': [['exclude', '<(tgvoip_src_loc)/os/linux/']],
},
],
[
'"<(OS)" == "mac"', {
'xcode_settings': {
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'ALWAYS_SEARCH_USER_PATHS': 'NO',
},
'defines': [
'WEBRTC_POSIX',
'WEBRTC_MAC',
'TARGET_OS_OSX',
],
'sources': [
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/logging_mac.mm',
'<(tgvoip_src_loc)/webrtc_dsp/rtc_base/logging_mac.h',
],
'conditions': [
[ '"<(official_build_target)" == "mac32"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.6',
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
'<(DEPTH)/../../../Libraries/macold/openssl/include',
],
'defines': [
'TARGET_OSX32',
],
}, {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.8',
'CLANG_CXX_LIBRARY': 'libc++',
},
'include_dirs': [
'<(DEPTH)/../../../Libraries/openssl/include',
],
'direct_dependent_settings': {
'linkflags': [
'-framework VideoToolbox',
],
},
'sources': [
'<(tgvoip_src_loc)/os/darwin/TGVVideoRenderer.mm',
'<(tgvoip_src_loc)/os/darwin/TGVVideoRenderer.h',
'<(tgvoip_src_loc)/os/darwin/TGVVideoSource.mm',
'<(tgvoip_src_loc)/os/darwin/TGVVideoSource.h',
'<(tgvoip_src_loc)/os/darwin/VideoToolboxEncoderSource.mm',
'<(tgvoip_src_loc)/os/darwin/VideoToolboxEncoderSource.h',
'<(tgvoip_src_loc)/os/darwin/SampleBufferDisplayLayerRenderer.mm',
'<(tgvoip_src_loc)/os/darwin/SampleBufferDisplayLayerRenderer.h',
],
}],
['"<(official_build_target)" == "macstore"', {
'defines': [
'TGVOIP_NO_OSX_PRIVATE_API',
],
}],
],
},
],
[
'"<(OS)" == "win"', {
'msbuild_toolset': 'v141',
'defines': [
'NOMINMAX',
'_USING_V110_SDK71_',
'TGVOIP_WINXP_COMPAT',
'WEBRTC_WIN',
],
'libraries': [
'winmm',
'ws2_32',
'kernel32',
'user32',
],
'msvs_cygwin_shell': 0,
'msvs_settings': {
'VCCLCompilerTool': {
'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
'DebugInformationFormat': '3', # Program Database (/Zi)
'AdditionalOptions': [
'/MP', # Enable multi process build.
'/EHsc', # Catch C++ exceptions only, extern C functions never throw a C++ exception.
'/wd4068', # Disable "warning C4068: unknown pragma"
],
'TreatWChar_tAsBuiltInType': 'false',
},
},
'msvs_external_builder_build_cmd': [
'ninja.exe',
'-C',
'$(OutDir)',
'-k0',
'$(ProjectName)',
],
'configurations': {
'Debug': {
'defines': [
'_DEBUG',
],
'include_dirs': [
'<(DEPTH)/../../../Libraries/openssl/Debug/include',
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '0', # Disabled (/Od)
'RuntimeLibrary': '1', # Multi-threaded Debug (/MTd)
'RuntimeTypeInfo': 'true',
},
'VCLibrarianTool': {
'AdditionalOptions': [
'/NODEFAULTLIB:LIBCMT'
]
}
},
},
'Release': {
'defines': [
'NDEBUG',
],
'include_dirs': [
'<(DEPTH)/../../../Libraries/openssl/Release/include',
],
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': '2', # Maximize Speed (/O2)
'InlineFunctionExpansion': '2', # Any suitable (/Ob2)
'EnableIntrinsicFunctions': 'true', # Yes (/Oi)
'FavorSizeOrSpeed': '1', # Favor fast code (/Ot)
'RuntimeLibrary': '0', # Multi-threaded (/MT)
'EnableEnhancedInstructionSet': '2', # Streaming SIMD Extensions 2 (/arch:SSE2)
'WholeProgramOptimization': 'true', # /GL
},
'VCLibrarianTool': {
'AdditionalOptions': [
'/LTCG',
]
},
},
},
},
},
],
[
'"<(OS)" == "linux"', {
'defines': [
'WEBRTC_POSIX',
'WEBRTC_LINUX',
],
'conditions': [
[ '"<!(uname -m)" == "i686"', {
'cflags_cc': [
'-msse2',
],
}]
],
'direct_dependent_settings': {
'libraries': [
],
},
},
],
],
},
],
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:libtgvoip.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
libtgvoip is free and unencumbered public domain software.
For more information, see http://unlicense.org or the UNLICENSE file
you should have received with this source code distribution.
</string>
</dict>
</plist>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:libtgvoip.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
libtgvoip is free and unencumbered public domain software.
For more information, see http://unlicense.org or the UNLICENSE file
you should have received with this source code distribution.
</string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -1,215 +0,0 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View File

@ -1,150 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: algorithm.h
// -----------------------------------------------------------------------------
//
// This header file contains Google extensions to the standard <algorithm> C++
// header.
#ifndef ABSL_ALGORITHM_ALGORITHM_H_
#define ABSL_ALGORITHM_ALGORITHM_H_
#include <algorithm>
#include <iterator>
#include <type_traits>
namespace absl {
namespace algorithm_internal {
// Performs comparisons with operator==, similar to C++14's `std::equal_to<>`.
struct EqualTo {
template <typename T, typename U>
bool operator()(const T& a, const U& b) const {
return a == b;
}
};
template <typename InputIter1, typename InputIter2, typename Pred>
bool EqualImpl(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2, Pred pred, std::input_iterator_tag,
std::input_iterator_tag) {
while (true) {
if (first1 == last1) return first2 == last2;
if (first2 == last2) return false;
if (!pred(*first1, *first2)) return false;
++first1;
++first2;
}
}
template <typename InputIter1, typename InputIter2, typename Pred>
bool EqualImpl(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2, Pred&& pred, std::random_access_iterator_tag,
std::random_access_iterator_tag) {
return (last1 - first1 == last2 - first2) &&
std::equal(first1, last1, first2, std::forward<Pred>(pred));
}
// When we are using our own internal predicate that just applies operator==, we
// forward to the non-predicate form of std::equal. This enables an optimization
// in libstdc++ that can result in std::memcmp being used for integer types.
template <typename InputIter1, typename InputIter2>
bool EqualImpl(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2, algorithm_internal::EqualTo /* unused */,
std::random_access_iterator_tag,
std::random_access_iterator_tag) {
return (last1 - first1 == last2 - first2) &&
std::equal(first1, last1, first2);
}
template <typename It>
It RotateImpl(It first, It middle, It last, std::true_type) {
return std::rotate(first, middle, last);
}
template <typename It>
It RotateImpl(It first, It middle, It last, std::false_type) {
std::rotate(first, middle, last);
return std::next(first, std::distance(middle, last));
}
} // namespace algorithm_internal
// Compares the equality of two ranges specified by pairs of iterators, using
// the given predicate, returning true iff for each corresponding iterator i1
// and i2 in the first and second range respectively, pred(*i1, *i2) == true
//
// This comparison takes at most min(`last1` - `first1`, `last2` - `first2`)
// invocations of the predicate. Additionally, if InputIter1 and InputIter2 are
// both random-access iterators, and `last1` - `first1` != `last2` - `first2`,
// then the predicate is never invoked and the function returns false.
//
// This is a C++11-compatible implementation of C++14 `std::equal`. See
// http://en.cppreference.com/w/cpp/algorithm/equal for more information.
template <typename InputIter1, typename InputIter2, typename Pred>
bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2, Pred&& pred) {
return algorithm_internal::EqualImpl(
first1, last1, first2, last2, std::forward<Pred>(pred),
typename std::iterator_traits<InputIter1>::iterator_category{},
typename std::iterator_traits<InputIter2>::iterator_category{});
}
// Performs comparison of two ranges specified by pairs of iterators using
// operator==.
template <typename InputIter1, typename InputIter2>
bool equal(InputIter1 first1, InputIter1 last1, InputIter2 first2,
InputIter2 last2) {
return absl::equal(first1, last1, first2, last2,
algorithm_internal::EqualTo{});
}
// Performs a linear search for `value` using the iterator `first` up to
// but not including `last`, returning true if [`first`, `last`) contains an
// element equal to `value`.
//
// A linear search is of O(n) complexity which is guaranteed to make at most
// n = (`last` - `first`) comparisons. A linear search over short containers
// may be faster than a binary search, even when the container is sorted.
template <typename InputIterator, typename EqualityComparable>
bool linear_search(InputIterator first, InputIterator last,
const EqualityComparable& value) {
return std::find(first, last, value) != last;
}
// Performs a left rotation on a range of elements (`first`, `last`) such that
// `middle` is now the first element. `rotate()` returns an iterator pointing to
// the first element before rotation. This function is exactly the same as
// `std::rotate`, but fixes a bug in gcc
// <= 4.9 where `std::rotate` returns `void` instead of an iterator.
//
// The complexity of this algorithm is the same as that of `std::rotate`, but if
// `ForwardIterator` is not a random-access iterator, then `absl::rotate`
// performs an additional pass over the range to construct the return value.
template <typename ForwardIterator>
ForwardIterator rotate(ForwardIterator first, ForwardIterator middle,
ForwardIterator last) {
return algorithm_internal::RotateImpl(
first, middle, last,
std::is_same<decltype(std::rotate(first, middle, last)),
ForwardIterator>());
}
} // namespace absl
#endif // ABSL_ALGORITHM_ALGORITHM_H_

View File

@ -1,597 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This header file defines macros for declaring attributes for functions,
// types, and variables.
//
// These macros are used within Abseil and allow the compiler to optimize, where
// applicable, certain function calls.
//
// This file is used for both C and C++!
//
// Most macros here are exposing GCC or Clang features, and are stubbed out for
// other compilers.
//
// GCC attributes documentation:
// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html
// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Variable-Attributes.html
// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Type-Attributes.html
//
// Most attributes in this file are already supported by GCC 4.7. However, some
// of them are not supported in older version of Clang. Thus, we check
// `__has_attribute()` first. If the check fails, we check if we are on GCC and
// assume the attribute exists on GCC (which is verified on GCC 4.7).
//
// -----------------------------------------------------------------------------
// Sanitizer Attributes
// -----------------------------------------------------------------------------
//
// Sanitizer-related attributes are not "defined" in this file (and indeed
// are not defined as such in any file). To utilize the following
// sanitizer-related attributes within your builds, define the following macros
// within your build using a `-D` flag, along with the given value for
// `-fsanitize`:
//
// * `ADDRESS_SANITIZER` + `-fsanitize=address` (Clang, GCC 4.8)
// * `MEMORY_SANITIZER` + `-fsanitize=memory` (Clang-only)
// * `THREAD_SANITIZER + `-fsanitize=thread` (Clang, GCC 4.8+)
// * `UNDEFINED_BEHAVIOR_SANITIZER` + `-fsanitize=undefined` (Clang, GCC 4.9+)
// * `CONTROL_FLOW_INTEGRITY` + -fsanitize=cfi (Clang-only)
//
// Example:
//
// // Enable branches in the Abseil code that are tagged for ASan:
// $ bazel build --copt=-DADDRESS_SANITIZER --copt=-fsanitize=address
// --linkopt=-fsanitize=address *target*
//
// Since these macro names are only supported by GCC and Clang, we only check
// for `__GNUC__` (GCC or Clang) and the above macros.
#ifndef ABSL_BASE_ATTRIBUTES_H_
#define ABSL_BASE_ATTRIBUTES_H_
// ABSL_HAVE_ATTRIBUTE
//
// A function-like feature checking macro that is a wrapper around
// `__has_attribute`, which is defined by GCC 5+ and Clang and evaluates to a
// nonzero constant integer if the attribute is supported or 0 if not.
//
// It evaluates to zero if `__has_attribute` is not defined by the compiler.
//
// GCC: https://gcc.gnu.org/gcc-5/changes.html
// Clang: https://clang.llvm.org/docs/LanguageExtensions.html
#ifdef __has_attribute
#define ABSL_HAVE_ATTRIBUTE(x) __has_attribute(x)
#else
#define ABSL_HAVE_ATTRIBUTE(x) 0
#endif
// ABSL_HAVE_CPP_ATTRIBUTE
//
// A function-like feature checking macro that accepts C++11 style attributes.
// It's a wrapper around `__has_cpp_attribute`, defined by ISO C++ SD-6
// (http://en.cppreference.com/w/cpp/experimental/feature_test). If we don't
// find `__has_cpp_attribute`, will evaluate to 0.
#if defined(__cplusplus) && defined(__has_cpp_attribute)
// NOTE: requiring __cplusplus above should not be necessary, but
// works around https://bugs.llvm.org/show_bug.cgi?id=23435.
#define ABSL_HAVE_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
#define ABSL_HAVE_CPP_ATTRIBUTE(x) 0
#endif
// -----------------------------------------------------------------------------
// Function Attributes
// -----------------------------------------------------------------------------
//
// GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
// Clang: https://clang.llvm.org/docs/AttributeReference.html
// ABSL_PRINTF_ATTRIBUTE
// ABSL_SCANF_ATTRIBUTE
//
// Tells the compiler to perform `printf` format string checking if the
// compiler supports it; see the 'format' attribute in
// <http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html>.
//
// Note: As the GCC manual states, "[s]ince non-static C++ methods
// have an implicit 'this' argument, the arguments of such methods
// should be counted from two, not one."
#if ABSL_HAVE_ATTRIBUTE(format) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check) \
__attribute__((__format__(__printf__, string_index, first_to_check)))
#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check) \
__attribute__((__format__(__scanf__, string_index, first_to_check)))
#else
#define ABSL_PRINTF_ATTRIBUTE(string_index, first_to_check)
#define ABSL_SCANF_ATTRIBUTE(string_index, first_to_check)
#endif
// ABSL_ATTRIBUTE_ALWAYS_INLINE
// ABSL_ATTRIBUTE_NOINLINE
//
// Forces functions to either inline or not inline. Introduced in gcc 3.1.
#if ABSL_HAVE_ATTRIBUTE(always_inline) || \
(defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
#define ABSL_HAVE_ATTRIBUTE_ALWAYS_INLINE 1
#else
#define ABSL_ATTRIBUTE_ALWAYS_INLINE
#endif
#if ABSL_HAVE_ATTRIBUTE(noinline) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_NOINLINE __attribute__((noinline))
#define ABSL_HAVE_ATTRIBUTE_NOINLINE 1
#else
#define ABSL_ATTRIBUTE_NOINLINE
#endif
// ABSL_ATTRIBUTE_NO_TAIL_CALL
//
// Prevents the compiler from optimizing away stack frames for functions which
// end in a call to another function.
#if ABSL_HAVE_ATTRIBUTE(disable_tail_calls)
#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1
#define ABSL_ATTRIBUTE_NO_TAIL_CALL __attribute__((disable_tail_calls))
#elif defined(__GNUC__) && !defined(__clang__)
#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 1
#define ABSL_ATTRIBUTE_NO_TAIL_CALL \
__attribute__((optimize("no-optimize-sibling-calls")))
#else
#define ABSL_ATTRIBUTE_NO_TAIL_CALL
#define ABSL_HAVE_ATTRIBUTE_NO_TAIL_CALL 0
#endif
// ABSL_ATTRIBUTE_WEAK
//
// Tags a function as weak for the purposes of compilation and linking.
// Weak attributes currently do not work properly in LLVM's Windows backend,
// so disable them there. See https://bugs.llvm.org/show_bug.cgi?id=37598
// for futher information.
#if (ABSL_HAVE_ATTRIBUTE(weak) || \
(defined(__GNUC__) && !defined(__clang__))) && \
!(defined(__llvm__) && defined(_WIN32))
#undef ABSL_ATTRIBUTE_WEAK
#define ABSL_ATTRIBUTE_WEAK __attribute__((weak))
#define ABSL_HAVE_ATTRIBUTE_WEAK 1
#else
#define ABSL_ATTRIBUTE_WEAK
#define ABSL_HAVE_ATTRIBUTE_WEAK 0
#endif
// ABSL_ATTRIBUTE_NONNULL
//
// Tells the compiler either (a) that a particular function parameter
// should be a non-null pointer, or (b) that all pointer arguments should
// be non-null.
//
// Note: As the GCC manual states, "[s]ince non-static C++ methods
// have an implicit 'this' argument, the arguments of such methods
// should be counted from two, not one."
//
// Args are indexed starting at 1.
//
// For non-static class member functions, the implicit `this` argument
// is arg 1, and the first explicit argument is arg 2. For static class member
// functions, there is no implicit `this`, and the first explicit argument is
// arg 1.
//
// Example:
//
// /* arg_a cannot be null, but arg_b can */
// void Function(void* arg_a, void* arg_b) ABSL_ATTRIBUTE_NONNULL(1);
//
// class C {
// /* arg_a cannot be null, but arg_b can */
// void Method(void* arg_a, void* arg_b) ABSL_ATTRIBUTE_NONNULL(2);
//
// /* arg_a cannot be null, but arg_b can */
// static void StaticMethod(void* arg_a, void* arg_b)
// ABSL_ATTRIBUTE_NONNULL(1);
// };
//
// If no arguments are provided, then all pointer arguments should be non-null.
//
// /* No pointer arguments may be null. */
// void Function(void* arg_a, void* arg_b, int arg_c) ABSL_ATTRIBUTE_NONNULL();
//
// NOTE: The GCC nonnull attribute actually accepts a list of arguments, but
// ABSL_ATTRIBUTE_NONNULL does not.
#if ABSL_HAVE_ATTRIBUTE(nonnull) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_NONNULL(arg_index) __attribute__((nonnull(arg_index)))
#else
#define ABSL_ATTRIBUTE_NONNULL(...)
#endif
// ABSL_ATTRIBUTE_NORETURN
//
// Tells the compiler that a given function never returns.
#if ABSL_HAVE_ATTRIBUTE(noreturn) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define ABSL_ATTRIBUTE_NORETURN __declspec(noreturn)
#else
#define ABSL_ATTRIBUTE_NORETURN
#endif
// ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS
//
// Tells the AddressSanitizer (or other memory testing tools) to ignore a given
// function. Useful for cases when a function reads random locations on stack,
// calls _exit from a cloned subprocess, deliberately accesses buffer
// out of bounds or does other scary things with memory.
// NOTE: GCC supports AddressSanitizer(asan) since 4.8.
// https://gcc.gnu.org/gcc-4.8/changes.html
#if defined(__GNUC__) && defined(ADDRESS_SANITIZER)
#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#else
#define ABSL_ATTRIBUTE_NO_SANITIZE_ADDRESS
#endif
// ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY
//
// Tells the MemorySanitizer to relax the handling of a given function. All
// "Use of uninitialized value" warnings from such functions will be suppressed,
// and all values loaded from memory will be considered fully initialized.
// This attribute is similar to the ADDRESS_SANITIZER attribute above, but deals
// with initialized-ness rather than addressability issues.
// NOTE: MemorySanitizer(msan) is supported by Clang but not GCC.
#if defined(__GNUC__) && defined(MEMORY_SANITIZER)
#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
#else
#define ABSL_ATTRIBUTE_NO_SANITIZE_MEMORY
#endif
// ABSL_ATTRIBUTE_NO_SANITIZE_THREAD
//
// Tells the ThreadSanitizer to not instrument a given function.
// NOTE: GCC supports ThreadSanitizer(tsan) since 4.8.
// https://gcc.gnu.org/gcc-4.8/changes.html
#if defined(__GNUC__) && defined(THREAD_SANITIZER)
#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD __attribute__((no_sanitize_thread))
#else
#define ABSL_ATTRIBUTE_NO_SANITIZE_THREAD
#endif
// ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED
//
// Tells the UndefinedSanitizer to ignore a given function. Useful for cases
// where certain behavior (eg. division by zero) is being used intentionally.
// NOTE: GCC supports UndefinedBehaviorSanitizer(ubsan) since 4.9.
// https://gcc.gnu.org/gcc-4.9/changes.html
#if defined(__GNUC__) && \
(defined(UNDEFINED_BEHAVIOR_SANITIZER) || defined(ADDRESS_SANITIZER))
#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED \
__attribute__((no_sanitize("undefined")))
#else
#define ABSL_ATTRIBUTE_NO_SANITIZE_UNDEFINED
#endif
// ABSL_ATTRIBUTE_NO_SANITIZE_CFI
//
// Tells the ControlFlowIntegrity sanitizer to not instrument a given function.
// See https://clang.llvm.org/docs/ControlFlowIntegrity.html for details.
#if defined(__GNUC__) && defined(CONTROL_FLOW_INTEGRITY)
#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi")))
#else
#define ABSL_ATTRIBUTE_NO_SANITIZE_CFI
#endif
// ABSL_ATTRIBUTE_RETURNS_NONNULL
//
// Tells the compiler that a particular function never returns a null pointer.
#if ABSL_HAVE_ATTRIBUTE(returns_nonnull) || \
(defined(__GNUC__) && \
(__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && \
!defined(__clang__))
#define ABSL_ATTRIBUTE_RETURNS_NONNULL __attribute__((returns_nonnull))
#else
#define ABSL_ATTRIBUTE_RETURNS_NONNULL
#endif
// ABSL_HAVE_ATTRIBUTE_SECTION
//
// Indicates whether labeled sections are supported. Weak symbol support is
// a prerequisite. Labeled sections are not supported on Darwin/iOS.
#ifdef ABSL_HAVE_ATTRIBUTE_SECTION
#error ABSL_HAVE_ATTRIBUTE_SECTION cannot be directly set
#elif (ABSL_HAVE_ATTRIBUTE(section) || \
(defined(__GNUC__) && !defined(__clang__))) && \
!defined(__APPLE__) && ABSL_HAVE_ATTRIBUTE_WEAK
#define ABSL_HAVE_ATTRIBUTE_SECTION 1
// ABSL_ATTRIBUTE_SECTION
//
// Tells the compiler/linker to put a given function into a section and define
// `__start_ ## name` and `__stop_ ## name` symbols to bracket the section.
// This functionality is supported by GNU linker. Any function annotated with
// `ABSL_ATTRIBUTE_SECTION` must not be inlined, or it will be placed into
// whatever section its caller is placed into.
//
#ifndef ABSL_ATTRIBUTE_SECTION
#define ABSL_ATTRIBUTE_SECTION(name) \
__attribute__((section(#name))) __attribute__((noinline))
#endif
// ABSL_ATTRIBUTE_SECTION_VARIABLE
//
// Tells the compiler/linker to put a given variable into a section and define
// `__start_ ## name` and `__stop_ ## name` symbols to bracket the section.
// This functionality is supported by GNU linker.
#ifndef ABSL_ATTRIBUTE_SECTION_VARIABLE
#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name) __attribute__((section(#name)))
#endif
// ABSL_DECLARE_ATTRIBUTE_SECTION_VARS
//
// A weak section declaration to be used as a global declaration
// for ABSL_ATTRIBUTE_SECTION_START|STOP(name) to compile and link
// even without functions with ABSL_ATTRIBUTE_SECTION(name).
// ABSL_DEFINE_ATTRIBUTE_SECTION should be in the exactly one file; it's
// a no-op on ELF but not on Mach-O.
//
#ifndef ABSL_DECLARE_ATTRIBUTE_SECTION_VARS
#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) \
extern char __start_##name[] ABSL_ATTRIBUTE_WEAK; \
extern char __stop_##name[] ABSL_ATTRIBUTE_WEAK
#endif
#ifndef ABSL_DEFINE_ATTRIBUTE_SECTION_VARS
#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name)
#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name)
#endif
// ABSL_ATTRIBUTE_SECTION_START
//
// Returns `void*` pointers to start/end of a section of code with
// functions having ABSL_ATTRIBUTE_SECTION(name).
// Returns 0 if no such functions exist.
// One must ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) for this to compile and
// link.
//
#define ABSL_ATTRIBUTE_SECTION_START(name) \
(reinterpret_cast<void *>(__start_##name))
#define ABSL_ATTRIBUTE_SECTION_STOP(name) \
(reinterpret_cast<void *>(__stop_##name))
#else // !ABSL_HAVE_ATTRIBUTE_SECTION
#define ABSL_HAVE_ATTRIBUTE_SECTION 0
// provide dummy definitions
#define ABSL_ATTRIBUTE_SECTION(name)
#define ABSL_ATTRIBUTE_SECTION_VARIABLE(name)
#define ABSL_INIT_ATTRIBUTE_SECTION_VARS(name)
#define ABSL_DEFINE_ATTRIBUTE_SECTION_VARS(name)
#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name)
#define ABSL_ATTRIBUTE_SECTION_START(name) (reinterpret_cast<void *>(0))
#define ABSL_ATTRIBUTE_SECTION_STOP(name) (reinterpret_cast<void *>(0))
#endif // ABSL_ATTRIBUTE_SECTION
// ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
//
// Support for aligning the stack on 32-bit x86.
#if ABSL_HAVE_ATTRIBUTE(force_align_arg_pointer) || \
(defined(__GNUC__) && !defined(__clang__))
#if defined(__i386__)
#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC \
__attribute__((force_align_arg_pointer))
#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0)
#elif defined(__x86_64__)
#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (1)
#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
#else // !__i386__ && !__x86_64
#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0)
#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
#endif // __i386__
#else
#define ABSL_ATTRIBUTE_STACK_ALIGN_FOR_OLD_LIBC
#define ABSL_REQUIRE_STACK_ALIGN_TRAMPOLINE (0)
#endif
// ABSL_MUST_USE_RESULT
//
// Tells the compiler to warn about unused results.
//
// When annotating a function, it must appear as the first part of the
// declaration or definition. The compiler will warn if the return value from
// such a function is unused:
//
// ABSL_MUST_USE_RESULT Sprocket* AllocateSprocket();
// AllocateSprocket(); // Triggers a warning.
//
// When annotating a class, it is equivalent to annotating every function which
// returns an instance.
//
// class ABSL_MUST_USE_RESULT Sprocket {};
// Sprocket(); // Triggers a warning.
//
// Sprocket MakeSprocket();
// MakeSprocket(); // Triggers a warning.
//
// Note that references and pointers are not instances:
//
// Sprocket* SprocketPointer();
// SprocketPointer(); // Does *not* trigger a warning.
//
// ABSL_MUST_USE_RESULT allows using cast-to-void to suppress the unused result
// warning. For that, warn_unused_result is used only for clang but not for gcc.
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
//
// Note: past advice was to place the macro after the argument list.
#if ABSL_HAVE_ATTRIBUTE(nodiscard)
#define ABSL_MUST_USE_RESULT [[nodiscard]]
#elif defined(__clang__) && ABSL_HAVE_ATTRIBUTE(warn_unused_result)
#define ABSL_MUST_USE_RESULT __attribute__((warn_unused_result))
#else
#define ABSL_MUST_USE_RESULT
#endif
// ABSL_ATTRIBUTE_HOT, ABSL_ATTRIBUTE_COLD
//
// Tells GCC that a function is hot or cold. GCC can use this information to
// improve static analysis, i.e. a conditional branch to a cold function
// is likely to be not-taken.
// This annotation is used for function declarations.
//
// Example:
//
// int foo() ABSL_ATTRIBUTE_HOT;
#if ABSL_HAVE_ATTRIBUTE(hot) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_HOT __attribute__((hot))
#else
#define ABSL_ATTRIBUTE_HOT
#endif
#if ABSL_HAVE_ATTRIBUTE(cold) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_COLD __attribute__((cold))
#else
#define ABSL_ATTRIBUTE_COLD
#endif
// ABSL_XRAY_ALWAYS_INSTRUMENT, ABSL_XRAY_NEVER_INSTRUMENT, ABSL_XRAY_LOG_ARGS
//
// We define the ABSL_XRAY_ALWAYS_INSTRUMENT and ABSL_XRAY_NEVER_INSTRUMENT
// macro used as an attribute to mark functions that must always or never be
// instrumented by XRay. Currently, this is only supported in Clang/LLVM.
//
// For reference on the LLVM XRay instrumentation, see
// http://llvm.org/docs/XRay.html.
//
// A function with the XRAY_ALWAYS_INSTRUMENT macro attribute in its declaration
// will always get the XRay instrumentation sleds. These sleds may introduce
// some binary size and runtime overhead and must be used sparingly.
//
// These attributes only take effect when the following conditions are met:
//
// * The file/target is built in at least C++11 mode, with a Clang compiler
// that supports XRay attributes.
// * The file/target is built with the -fxray-instrument flag set for the
// Clang/LLVM compiler.
// * The function is defined in the translation unit (the compiler honors the
// attribute in either the definition or the declaration, and must match).
//
// There are cases when, even when building with XRay instrumentation, users
// might want to control specifically which functions are instrumented for a
// particular build using special-case lists provided to the compiler. These
// special case lists are provided to Clang via the
// -fxray-always-instrument=... and -fxray-never-instrument=... flags. The
// attributes in source take precedence over these special-case lists.
//
// To disable the XRay attributes at build-time, users may define
// ABSL_NO_XRAY_ATTRIBUTES. Do NOT define ABSL_NO_XRAY_ATTRIBUTES on specific
// packages/targets, as this may lead to conflicting definitions of functions at
// link-time.
//
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::xray_always_instrument) && \
!defined(ABSL_NO_XRAY_ATTRIBUTES)
#define ABSL_XRAY_ALWAYS_INSTRUMENT [[clang::xray_always_instrument]]
#define ABSL_XRAY_NEVER_INSTRUMENT [[clang::xray_never_instrument]]
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::xray_log_args)
#define ABSL_XRAY_LOG_ARGS(N) \
[[clang::xray_always_instrument, clang::xray_log_args(N)]]
#else
#define ABSL_XRAY_LOG_ARGS(N) [[clang::xray_always_instrument]]
#endif
#else
#define ABSL_XRAY_ALWAYS_INSTRUMENT
#define ABSL_XRAY_NEVER_INSTRUMENT
#define ABSL_XRAY_LOG_ARGS(N)
#endif
// ABSL_ATTRIBUTE_REINITIALIZES
//
// Indicates that a member function reinitializes the entire object to a known
// state, independent of the previous state of the object.
//
// The clang-tidy check bugprone-use-after-move allows member functions marked
// with this attribute to be called on objects that have been moved from;
// without the attribute, this would result in a use-after-move warning.
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::reinitializes)
#define ABSL_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]]
#else
#define ABSL_ATTRIBUTE_REINITIALIZES
#endif
// -----------------------------------------------------------------------------
// Variable Attributes
// -----------------------------------------------------------------------------
// ABSL_ATTRIBUTE_UNUSED
//
// Prevents the compiler from complaining about variables that appear unused.
#if ABSL_HAVE_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
#undef ABSL_ATTRIBUTE_UNUSED
#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
#else
#define ABSL_ATTRIBUTE_UNUSED
#endif
// ABSL_ATTRIBUTE_INITIAL_EXEC
//
// Tells the compiler to use "initial-exec" mode for a thread-local variable.
// See http://people.redhat.com/drepper/tls.pdf for the gory details.
#if ABSL_HAVE_ATTRIBUTE(tls_model) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_INITIAL_EXEC __attribute__((tls_model("initial-exec")))
#else
#define ABSL_ATTRIBUTE_INITIAL_EXEC
#endif
// ABSL_ATTRIBUTE_PACKED
//
// Prevents the compiler from padding a structure to natural alignment
#if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_PACKED __attribute__((__packed__))
#else
#define ABSL_ATTRIBUTE_PACKED
#endif
// ABSL_ATTRIBUTE_FUNC_ALIGN
//
// Tells the compiler to align the function start at least to certain
// alignment boundary
#if ABSL_HAVE_ATTRIBUTE(aligned) || (defined(__GNUC__) && !defined(__clang__))
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
#else
#define ABSL_ATTRIBUTE_FUNC_ALIGN(bytes)
#endif
// ABSL_CONST_INIT
//
// A variable declaration annotated with the `ABSL_CONST_INIT` attribute will
// not compile (on supported platforms) unless the variable has a constant
// initializer. This is useful for variables with static and thread storage
// duration, because it guarantees that they will not suffer from the so-called
// "static init order fiasco". Prefer to put this attribute on the most visible
// declaration of the variable, if there's more than one, because code that
// accesses the variable can then use the attribute for optimization.
//
// Example:
//
// class MyClass {
// public:
// ABSL_CONST_INIT static MyType my_var;
// };
//
// MyType MyClass::my_var = MakeMyType(...);
//
// Note that this attribute is redundant if the variable is declared constexpr.
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization)
// NOLINTNEXTLINE(whitespace/braces)
#define ABSL_CONST_INIT [[clang::require_constant_initialization]]
#else
#define ABSL_CONST_INIT
#endif // ABSL_HAVE_CPP_ATTRIBUTE(clang::require_constant_initialization)
#endif // ABSL_BASE_ATTRIBUTES_H_

View File

@ -1,443 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: config.h
// -----------------------------------------------------------------------------
//
// This header file defines a set of macros for checking the presence of
// important compiler and platform features. Such macros can be used to
// produce portable code by parameterizing compilation based on the presence or
// lack of a given feature.
//
// We define a "feature" as some interface we wish to program to: for example,
// a library function or system call. A value of `1` indicates support for
// that feature; any other value indicates the feature support is undefined.
//
// Example:
//
// Suppose a programmer wants to write a program that uses the 'mmap()' system
// call. The Abseil macro for that feature (`ABSL_HAVE_MMAP`) allows you to
// selectively include the `mmap.h` header and bracket code using that feature
// in the macro:
//
// #include "absl/base/config.h"
//
// #ifdef ABSL_HAVE_MMAP
// #include "sys/mman.h"
// #endif //ABSL_HAVE_MMAP
//
// ...
// #ifdef ABSL_HAVE_MMAP
// void *ptr = mmap(...);
// ...
// #endif // ABSL_HAVE_MMAP
#ifndef ABSL_BASE_CONFIG_H_
#define ABSL_BASE_CONFIG_H_
// Included for the __GLIBC__ macro (or similar macros on other systems).
#include <limits.h>
#ifdef __cplusplus
// Included for __GLIBCXX__, _LIBCPP_VERSION
#include <cstddef>
#endif // __cplusplus
#if defined(__APPLE__)
// Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED,
// __IPHONE_8_0.
#include <Availability.h>
#include <TargetConditionals.h>
#endif
#include "absl/base/policy_checks.h"
// -----------------------------------------------------------------------------
// Compiler Feature Checks
// -----------------------------------------------------------------------------
// ABSL_HAVE_BUILTIN()
//
// Checks whether the compiler supports a Clang Feature Checking Macro, and if
// so, checks whether it supports the provided builtin function "x" where x
// is one of the functions noted in
// https://clang.llvm.org/docs/LanguageExtensions.html
//
// Note: Use this macro to avoid an extra level of #ifdef __has_builtin check.
// http://releases.llvm.org/3.3/tools/clang/docs/LanguageExtensions.html
#ifdef __has_builtin
#define ABSL_HAVE_BUILTIN(x) __has_builtin(x)
#else
#define ABSL_HAVE_BUILTIN(x) 0
#endif
// ABSL_HAVE_TLS is defined to 1 when __thread should be supported.
// We assume __thread is supported on Linux when compiled with Clang or compiled
// against libstdc++ with _GLIBCXX_HAVE_TLS defined.
#ifdef ABSL_HAVE_TLS
#error ABSL_HAVE_TLS cannot be directly set
#elif defined(__linux__) && (defined(__clang__) || defined(_GLIBCXX_HAVE_TLS))
#define ABSL_HAVE_TLS 1
#endif
// ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
//
// Checks whether `std::is_trivially_destructible<T>` is supported.
//
// Notes: All supported compilers using libc++ support this feature, as does
// gcc >= 4.8.1 using libstdc++, and Visual Studio.
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
#error ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE cannot be directly set
#elif defined(_LIBCPP_VERSION) || \
(!defined(__clang__) && defined(__GNUC__) && defined(__GLIBCXX__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
defined(_MSC_VER)
#define ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
#endif
// ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
//
// Checks whether `std::is_trivially_default_constructible<T>` and
// `std::is_trivially_copy_constructible<T>` are supported.
// ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
//
// Checks whether `std::is_trivially_copy_assignable<T>` is supported.
// Notes: Clang with libc++ supports these features, as does gcc >= 5.1 with
// either libc++ or libstdc++, and Visual Studio.
#if defined(ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE)
#error ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE cannot be directly set
#elif defined(ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE)
#error ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE cannot directly set
#elif (defined(__clang__) && defined(_LIBCPP_VERSION)) || \
(!defined(__clang__) && defined(__GNUC__) && \
(__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)) && \
(defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \
defined(_MSC_VER)
#define ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE 1
#define ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE 1
#endif
// ABSL_HAVE_THREAD_LOCAL
//
// Checks whether C++11's `thread_local` storage duration specifier is
// supported.
#ifdef ABSL_HAVE_THREAD_LOCAL
#error ABSL_HAVE_THREAD_LOCAL cannot be directly set
#elif defined(__APPLE__)
// Notes:
// * Xcode's clang did not support `thread_local` until version 8, and
// even then not for all iOS < 9.0.
// * Xcode 9.3 started disallowing `thread_local` for 32-bit iOS simulator
// targeting iOS 9.x.
// * Xcode 10 moves the deployment target check for iOS < 9.0 to link time
// making __has_feature unreliable there.
//
// Otherwise, `__has_feature` is only supported by Clang so it has be inside
// `defined(__APPLE__)` check.
#if __has_feature(cxx_thread_local) && \
!(TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)
#define ABSL_HAVE_THREAD_LOCAL 1
#endif
#else // !defined(__APPLE__)
#define ABSL_HAVE_THREAD_LOCAL 1
#endif
// There are platforms for which TLS should not be used even though the compiler
// makes it seem like it's supported (Android NDK < r12b for example).
// This is primarily because of linker problems and toolchain misconfiguration:
// Abseil does not intend to support this indefinitely. Currently, the newest
// toolchain that we intend to support that requires this behavior is the
// r11 NDK - allowing for a 5 year support window on that means this option
// is likely to be removed around June of 2021.
// TLS isn't supported until NDK r12b per
// https://developer.android.com/ndk/downloads/revision_history.html
// Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
// <android/ndk-version.h>. For NDK < r16, users should define these macros,
// e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11.
#if defined(__ANDROID__) && defined(__clang__)
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif // __has_include(<android/ndk-version.h>)
#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
defined(__NDK_MINOR__) && \
((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
#undef ABSL_HAVE_TLS
#undef ABSL_HAVE_THREAD_LOCAL
#endif
#endif // defined(__ANDROID__) && defined(__clang__)
// ABSL_HAVE_INTRINSIC_INT128
//
// Checks whether the __int128 compiler extension for a 128-bit integral type is
// supported.
//
// Note: __SIZEOF_INT128__ is defined by Clang and GCC when __int128 is
// supported, but we avoid using it in certain cases:
// * On Clang:
// * Building using Clang for Windows, where the Clang runtime library has
// 128-bit support only on LP64 architectures, but Windows is LLP64.
// * Building for aarch64, where __int128 exists but has exhibits a sporadic
// compiler crashing bug.
// * On Nvidia's nvcc:
// * nvcc also defines __GNUC__ and __SIZEOF_INT128__, but not all versions
// actually support __int128.
#ifdef ABSL_HAVE_INTRINSIC_INT128
#error ABSL_HAVE_INTRINSIC_INT128 cannot be directly set
#elif defined(__SIZEOF_INT128__)
#if (defined(__clang__) && !defined(_WIN32) && !defined(__aarch64__)) || \
(defined(__CUDACC__) && __CUDACC_VER_MAJOR__ >= 9) || \
(defined(__GNUC__) && !defined(__clang__) && !defined(__CUDACC__))
#define ABSL_HAVE_INTRINSIC_INT128 1
#elif defined(__CUDACC__)
// __CUDACC_VER__ is a full version number before CUDA 9, and is defined to a
// string explaining that it has been removed starting with CUDA 9. We use
// nested #ifs because there is no short-circuiting in the preprocessor.
// NOTE: `__CUDACC__` could be undefined while `__CUDACC_VER__` is defined.
#if __CUDACC_VER__ >= 70000
#define ABSL_HAVE_INTRINSIC_INT128 1
#endif // __CUDACC_VER__ >= 70000
#endif // defined(__CUDACC__)
#endif // ABSL_HAVE_INTRINSIC_INT128
// ABSL_HAVE_EXCEPTIONS
//
// Checks whether the compiler both supports and enables exceptions. Many
// compilers support a "no exceptions" mode that disables exceptions.
//
// Generally, when ABSL_HAVE_EXCEPTIONS is not defined:
//
// * Code using `throw` and `try` may not compile.
// * The `noexcept` specifier will still compile and behave as normal.
// * The `noexcept` operator may still return `false`.
//
// For further details, consult the compiler's documentation.
#ifdef ABSL_HAVE_EXCEPTIONS
#error ABSL_HAVE_EXCEPTIONS cannot be directly set.
#elif defined(__clang__)
// TODO(calabrese)
// Switch to using __cpp_exceptions when we no longer support versions < 3.6.
// For details on this check, see:
// http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-exceptions-macro
#if defined(__EXCEPTIONS) && __has_feature(cxx_exceptions)
#define ABSL_HAVE_EXCEPTIONS 1
#endif // defined(__EXCEPTIONS) && __has_feature(cxx_exceptions)
// Handle remaining special cases and default to exceptions being supported.
#elif !(defined(__GNUC__) && (__GNUC__ < 5) && !defined(__EXCEPTIONS)) && \
!(defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__cpp_exceptions)) && \
!(defined(_MSC_VER) && !defined(_CPPUNWIND))
#define ABSL_HAVE_EXCEPTIONS 1
#endif
// -----------------------------------------------------------------------------
// Platform Feature Checks
// -----------------------------------------------------------------------------
// Currently supported operating systems and associated preprocessor
// symbols:
//
// Linux and Linux-derived __linux__
// Android __ANDROID__ (implies __linux__)
// Linux (non-Android) __linux__ && !__ANDROID__
// Darwin (Mac OS X and iOS) __APPLE__
// Akaros (http://akaros.org) __ros__
// Windows _WIN32
// NaCL __native_client__
// AsmJS __asmjs__
// WebAssembly __wasm__
// Fuchsia __Fuchsia__
//
// Note that since Android defines both __ANDROID__ and __linux__, one
// may probe for either Linux or Android by simply testing for __linux__.
// ABSL_HAVE_MMAP
//
// Checks whether the platform has an mmap(2) implementation as defined in
// POSIX.1-2001.
#ifdef ABSL_HAVE_MMAP
#error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__) || defined(__native_client__) || defined(__asmjs__) || \
defined(__wasm__) || defined(__Fuchsia__) || defined(__sun) || \
defined(__ASYLO__)
#define ABSL_HAVE_MMAP 1
#endif
// ABSL_HAVE_PTHREAD_GETSCHEDPARAM
//
// Checks whether the platform implements the pthread_(get|set)schedparam(3)
// functions as defined in POSIX.1-2001.
#ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
#error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__ros__)
#define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1
#endif
// ABSL_HAVE_SCHED_YIELD
//
// Checks whether the platform implements sched_yield(2) as defined in
// POSIX.1-2001.
#ifdef ABSL_HAVE_SCHED_YIELD
#error ABSL_HAVE_SCHED_YIELD cannot be directly set
#elif defined(__linux__) || defined(__ros__) || defined(__native_client__)
#define ABSL_HAVE_SCHED_YIELD 1
#endif
// ABSL_HAVE_SEMAPHORE_H
//
// Checks whether the platform supports the <semaphore.h> header and sem_open(3)
// family of functions as standardized in POSIX.1-2001.
//
// Note: While Apple provides <semaphore.h> for both iOS and macOS, it is
// explicitly deprecated and will cause build failures if enabled for those
// platforms. We side-step the issue by not defining it here for Apple
// platforms.
#ifdef ABSL_HAVE_SEMAPHORE_H
#error ABSL_HAVE_SEMAPHORE_H cannot be directly set
#elif defined(__linux__) || defined(__ros__)
#define ABSL_HAVE_SEMAPHORE_H 1
#endif
// ABSL_HAVE_ALARM
//
// Checks whether the platform supports the <signal.h> header and alarm(2)
// function as standardized in POSIX.1-2001.
#ifdef ABSL_HAVE_ALARM
#error ABSL_HAVE_ALARM cannot be directly set
#elif defined(__GOOGLE_GRTE_VERSION__)
// feature tests for Google's GRTE
#define ABSL_HAVE_ALARM 1
#elif defined(__GLIBC__)
// feature test for glibc
#define ABSL_HAVE_ALARM 1
#elif defined(_MSC_VER)
// feature tests for Microsoft's library
#elif defined(__EMSCRIPTEN__)
// emscripten doesn't support signals
#elif defined(__native_client__)
#else
// other standard libraries
#define ABSL_HAVE_ALARM 1
#endif
// ABSL_IS_LITTLE_ENDIAN
// ABSL_IS_BIG_ENDIAN
//
// Checks the endianness of the platform.
//
// Notes: uses the built in endian macros provided by GCC (since 4.6) and
// Clang (since 3.2); see
// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html.
// Otherwise, if _WIN32, assume little endian. Otherwise, bail with an error.
#if defined(ABSL_IS_BIG_ENDIAN)
#error "ABSL_IS_BIG_ENDIAN cannot be directly set."
#endif
#if defined(ABSL_IS_LITTLE_ENDIAN)
#error "ABSL_IS_LITTLE_ENDIAN cannot be directly set."
#endif
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define ABSL_IS_LITTLE_ENDIAN 1
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define ABSL_IS_BIG_ENDIAN 1
#elif defined(_WIN32)
#define ABSL_IS_LITTLE_ENDIAN 1
#else
#error "absl endian detection needs to be set up for your compiler"
#endif
// ABSL_HAVE_STD_ANY
//
// Checks whether C++17 std::any is available by checking whether <any> exists.
#ifdef ABSL_HAVE_STD_ANY
#error "ABSL_HAVE_STD_ANY cannot be directly set."
#endif
#ifdef __has_include
#if __has_include(<any>) && __cplusplus >= 201703L
#define ABSL_HAVE_STD_ANY 1
#endif
#endif
// ABSL_HAVE_STD_OPTIONAL
//
// Checks whether C++17 std::optional is available.
#ifdef ABSL_HAVE_STD_OPTIONAL
#error "ABSL_HAVE_STD_OPTIONAL cannot be directly set."
#endif
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L
#define ABSL_HAVE_STD_OPTIONAL 1
#endif
#endif
// ABSL_HAVE_STD_VARIANT
//
// Checks whether C++17 std::variant is available.
#ifdef ABSL_HAVE_STD_VARIANT
#error "ABSL_HAVE_STD_VARIANT cannot be directly set."
#endif
#ifdef __has_include
#if __has_include(<variant>) && __cplusplus >= 201703L
#define ABSL_HAVE_STD_VARIANT 1
#endif
#endif
// ABSL_HAVE_STD_STRING_VIEW
//
// Checks whether C++17 std::string_view is available.
#ifdef ABSL_HAVE_STD_STRING_VIEW
#error "ABSL_HAVE_STD_STRING_VIEW cannot be directly set."
#endif
#ifdef __has_include
#if __has_include(<string_view>) && __cplusplus >= 201703L
#define ABSL_HAVE_STD_STRING_VIEW 1
#endif
#endif
// For MSVC, `__has_include` is supported in VS 2017 15.3, which is later than
// the support for <optional>, <any>, <string_view>, <variant>. So we use
// _MSC_VER to check whether we have VS 2017 RTM (when <optional>, <any>,
// <string_view>, <variant> is implemented) or higher. Also, `__cplusplus` is
// not correctly set by MSVC, so we use `_MSVC_LANG` to check the language
// version.
// TODO(zhangxy): fix tests before enabling aliasing for `std::any`.
#if defined(_MSC_VER) && _MSC_VER >= 1910 && \
((defined(_MSVC_LANG) && _MSVC_LANG > 201402) || __cplusplus > 201402)
// #define ABSL_HAVE_STD_ANY 1
#define ABSL_HAVE_STD_OPTIONAL 1
#define ABSL_HAVE_STD_VARIANT 1
#define ABSL_HAVE_STD_STRING_VIEW 1
#endif
// In debug mode, MSVC 2017's std::variant throws a EXCEPTION_ACCESS_VIOLATION
// SEH exception from emplace for variant<SomeStruct> when constructing the
// struct can throw. This defeats some of variant_test and
// variant_exception_safety_test.
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_DEBUG)
#define ABSL_INTERNAL_MSVC_2017_DBG_MODE
#endif
#endif // ABSL_BASE_CONFIG_H_

View File

@ -1,165 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef ABSL_BASE_INTERNAL_ATOMIC_HOOK_H_
#define ABSL_BASE_INTERNAL_ATOMIC_HOOK_H_
#include <atomic>
#include <cassert>
#include <cstdint>
#include <utility>
#ifdef _MSC_FULL_VER
#define ABSL_HAVE_WORKING_ATOMIC_POINTER 0
#else
#define ABSL_HAVE_WORKING_ATOMIC_POINTER 1
#endif
namespace absl {
namespace base_internal {
template <typename T>
class AtomicHook;
// AtomicHook is a helper class, templatized on a raw function pointer type, for
// implementing Abseil customization hooks. It is a callable object that
// dispatches to the registered hook.
//
// A default constructed object performs a no-op (and returns a default
// constructed object) if no hook has been registered.
//
// Hooks can be pre-registered via constant initialization, for example,
// ABSL_CONST_INIT static AtomicHook<void(*)()> my_hook(DefaultAction);
// and then changed at runtime via a call to Store().
//
// Reads and writes guarantee memory_order_acquire/memory_order_release
// semantics.
template <typename ReturnType, typename... Args>
class AtomicHook<ReturnType (*)(Args...)> {
public:
using FnPtr = ReturnType (*)(Args...);
// Constructs an object that by default performs a no-op (and
// returns a default constructed object) when no hook as been registered.
constexpr AtomicHook() : AtomicHook(DummyFunction) {}
// Constructs an object that by default dispatches to/returns the
// pre-registered default_fn when no hook has been registered at runtime.
#if ABSL_HAVE_WORKING_ATOMIC_POINTER
explicit constexpr AtomicHook(FnPtr default_fn)
: hook_(default_fn), default_fn_(default_fn) {}
#else
explicit constexpr AtomicHook(FnPtr default_fn)
: hook_(kUninitialized), default_fn_(default_fn) {}
#endif
// Stores the provided function pointer as the value for this hook.
//
// This is intended to be called once. Multiple calls are legal only if the
// same function pointer is provided for each call. The store is implemented
// as a memory_order_release operation, and read accesses are implemented as
// memory_order_acquire.
void Store(FnPtr fn) {
bool success = DoStore(fn);
static_cast<void>(success);
assert(success);
}
// Invokes the registered callback. If no callback has yet been registered, a
// default-constructed object of the appropriate type is returned instead.
template <typename... CallArgs>
ReturnType operator()(CallArgs&&... args) const {
return DoLoad()(std::forward<CallArgs>(args)...);
}
// Returns the registered callback, or nullptr if none has been registered.
// Useful if client code needs to conditionalize behavior based on whether a
// callback was registered.
//
// Note that atomic_hook.Load()() and atomic_hook() have different semantics:
// operator()() will perform a no-op if no callback was registered, while
// Load()() will dereference a null function pointer. Prefer operator()() to
// Load()() unless you must conditionalize behavior on whether a hook was
// registered.
FnPtr Load() const {
FnPtr ptr = DoLoad();
return (ptr == DummyFunction) ? nullptr : ptr;
}
private:
static ReturnType DummyFunction(Args...) {
return ReturnType();
}
// Current versions of MSVC (as of September 2017) have a broken
// implementation of std::atomic<T*>: Its constructor attempts to do the
// equivalent of a reinterpret_cast in a constexpr context, which is not
// allowed.
//
// This causes an issue when building with LLVM under Windows. To avoid this,
// we use a less-efficient, intptr_t-based implementation on Windows.
#if ABSL_HAVE_WORKING_ATOMIC_POINTER
// Return the stored value, or DummyFunction if no value has been stored.
FnPtr DoLoad() const { return hook_.load(std::memory_order_acquire); }
// Store the given value. Returns false if a different value was already
// stored to this object.
bool DoStore(FnPtr fn) {
assert(fn);
FnPtr expected = default_fn_;
const bool store_succeeded = hook_.compare_exchange_strong(
expected, fn, std::memory_order_acq_rel, std::memory_order_acquire);
const bool same_value_already_stored = (expected == fn);
return store_succeeded || same_value_already_stored;
}
std::atomic<FnPtr> hook_;
#else // !ABSL_HAVE_WORKING_ATOMIC_POINTER
// Use a sentinel value unlikely to be the address of an actual function.
static constexpr intptr_t kUninitialized = 0;
static_assert(sizeof(intptr_t) >= sizeof(FnPtr),
"intptr_t can't contain a function pointer");
FnPtr DoLoad() const {
const intptr_t value = hook_.load(std::memory_order_acquire);
if (value == kUninitialized) {
return default_fn_;
}
return reinterpret_cast<FnPtr>(value);
}
bool DoStore(FnPtr fn) {
assert(fn);
const auto value = reinterpret_cast<intptr_t>(fn);
intptr_t expected = kUninitialized;
const bool store_succeeded = hook_.compare_exchange_strong(
expected, value, std::memory_order_acq_rel, std::memory_order_acquire);
const bool same_value_already_stored = (expected == value);
return store_succeeded || same_value_already_stored;
}
std::atomic<intptr_t> hook_;
#endif
const FnPtr default_fn_;
};
#undef ABSL_HAVE_WORKING_ATOMIC_POINTER
} // namespace base_internal
} // namespace absl
#endif // ABSL_BASE_INTERNAL_ATOMIC_HOOK_H_

View File

@ -1,33 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef ABSL_BASE_INTERNAL_IDENTITY_H_
#define ABSL_BASE_INTERNAL_IDENTITY_H_
namespace absl {
namespace internal {
template <typename T>
struct identity {
typedef T type;
};
template <typename T>
using identity_t = typename identity<T>::type;
} // namespace internal
} // namespace absl
#endif // ABSL_BASE_INTERNAL_IDENTITY_H_

View File

@ -1,107 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
#define ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_
#include <type_traits>
#include "absl/base/internal/identity.h"
// File:
// This file define a macro that allows the creation of or emulation of C++17
// inline variables based on whether or not the feature is supported.
////////////////////////////////////////////////////////////////////////////////
// Macro: ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init)
//
// Description:
// Expands to the equivalent of an inline constexpr instance of the specified
// `type` and `name`, initialized to the value `init`. If the compiler being
// used is detected as supporting actual inline variables as a language
// feature, then the macro expands to an actual inline variable definition.
//
// Requires:
// `type` is a type that is usable in an extern variable declaration.
//
// Requires: `name` is a valid identifier
//
// Requires:
// `init` is an expression that can be used in the following definition:
// constexpr type name = init;
//
// Usage:
//
// // Equivalent to: `inline constexpr size_t variant_npos = -1;`
// ABSL_INTERNAL_INLINE_CONSTEXPR(size_t, variant_npos, -1);
//
// Differences in implementation:
// For a direct, language-level inline variable, decltype(name) will be the
// type that was specified along with const qualification, whereas for
// emulated inline variables, decltype(name) may be different (in practice
// it will likely be a reference type).
////////////////////////////////////////////////////////////////////////////////
#ifdef __cpp_inline_variables
// Clang's -Wmissing-variable-declarations option erroneously warned that
// inline constexpr objects need to be pre-declared. This has now been fixed,
// but we will need to support this workaround for people building with older
// versions of clang.
//
// Bug: https://bugs.llvm.org/show_bug.cgi?id=35862
//
// Note:
// identity_t is used here so that the const and name are in the
// appropriate place for pointer types, reference types, function pointer
// types, etc..
#if defined(__clang__)
#define ABSL_INTERNAL_EXTERN_DECL(type, name) \
extern const ::absl::internal::identity_t<type> name;
#else // Otherwise, just define the macro to do nothing.
#define ABSL_INTERNAL_EXTERN_DECL(type, name)
#endif // defined(__clang__)
// See above comment at top of file for details.
#define ABSL_INTERNAL_INLINE_CONSTEXPR(type, name, init) \
ABSL_INTERNAL_EXTERN_DECL(type, name) \
inline constexpr ::absl::internal::identity_t<type> name = init
#else
// See above comment at top of file for details.
//
// Note:
// identity_t is used here so that the const and name are in the
// appropriate place for pointer types, reference types, function pointer
// types, etc..
#define ABSL_INTERNAL_INLINE_CONSTEXPR(var_type, name, init) \
template <class /*AbslInternalDummy*/ = void> \
struct AbslInternalInlineVariableHolder##name { \
static constexpr ::absl::internal::identity_t<var_type> kInstance = init; \
}; \
\
template <class AbslInternalDummy> \
constexpr ::absl::internal::identity_t<var_type> \
AbslInternalInlineVariableHolder##name<AbslInternalDummy>::kInstance; \
\
static constexpr const ::absl::internal::identity_t<var_type>& \
name = /* NOLINT */ \
AbslInternalInlineVariableHolder##name<>::kInstance; \
static_assert(sizeof(void (*)(decltype(name))) != 0, \
"Silence unused variable warnings.")
#endif // __cpp_inline_variables
#endif // ABSL_BASE_INTERNAL_INLINE_VARIABLE_EMULATION_H_

View File

@ -1,188 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// absl::base_internal::Invoke(f, args...) is an implementation of
// INVOKE(f, args...) from section [func.require] of the C++ standard.
//
// [func.require]
// Define INVOKE (f, t1, t2, ..., tN) as follows:
// 1. (t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T
// and t1 is an object of type T or a reference to an object of type T or a
// reference to an object of a type derived from T;
// 2. ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a
// class T and t1 is not one of the types described in the previous item;
// 3. t1.*f when N == 1 and f is a pointer to member data of a class T and t1 is
// an object of type T or a reference to an object of type T or a reference
// to an object of a type derived from T;
// 4. (*t1).*f when N == 1 and f is a pointer to member data of a class T and t1
// is not one of the types described in the previous item;
// 5. f(t1, t2, ..., tN) in all other cases.
//
// The implementation is SFINAE-friendly: substitution failure within Invoke()
// isn't an error.
#ifndef ABSL_BASE_INTERNAL_INVOKE_H_
#define ABSL_BASE_INTERNAL_INVOKE_H_
#include <algorithm>
#include <type_traits>
#include <utility>
// The following code is internal implementation detail. See the comment at the
// top of this file for the API documentation.
namespace absl {
namespace base_internal {
// The five classes below each implement one of the clauses from the definition
// of INVOKE. The inner class template Accept<F, Args...> checks whether the
// clause is applicable; static function template Invoke(f, args...) does the
// invocation.
//
// By separating the clause selection logic from invocation we make sure that
// Invoke() does exactly what the standard says.
template <typename Derived>
struct StrippedAccept {
template <typename... Args>
struct Accept : Derived::template AcceptImpl<typename std::remove_cv<
typename std::remove_reference<Args>::type>::type...> {};
};
// (t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T
// and t1 is an object of type T or a reference to an object of type T or a
// reference to an object of a type derived from T.
struct MemFunAndRef : StrippedAccept<MemFunAndRef> {
template <typename... Args>
struct AcceptImpl : std::false_type {};
template <typename R, typename C, typename... Params, typename Obj,
typename... Args>
struct AcceptImpl<R (C::*)(Params...), Obj, Args...>
: std::is_base_of<C, Obj> {};
template <typename R, typename C, typename... Params, typename Obj,
typename... Args>
struct AcceptImpl<R (C::*)(Params...) const, Obj, Args...>
: std::is_base_of<C, Obj> {};
template <typename MemFun, typename Obj, typename... Args>
static decltype((std::declval<Obj>().*
std::declval<MemFun>())(std::declval<Args>()...))
Invoke(MemFun&& mem_fun, Obj&& obj, Args&&... args) {
return (std::forward<Obj>(obj).*
std::forward<MemFun>(mem_fun))(std::forward<Args>(args)...);
}
};
// ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a
// class T and t1 is not one of the types described in the previous item.
struct MemFunAndPtr : StrippedAccept<MemFunAndPtr> {
template <typename... Args>
struct AcceptImpl : std::false_type {};
template <typename R, typename C, typename... Params, typename Ptr,
typename... Args>
struct AcceptImpl<R (C::*)(Params...), Ptr, Args...>
: std::integral_constant<bool, !std::is_base_of<C, Ptr>::value> {};
template <typename R, typename C, typename... Params, typename Ptr,
typename... Args>
struct AcceptImpl<R (C::*)(Params...) const, Ptr, Args...>
: std::integral_constant<bool, !std::is_base_of<C, Ptr>::value> {};
template <typename MemFun, typename Ptr, typename... Args>
static decltype(((*std::declval<Ptr>()).*
std::declval<MemFun>())(std::declval<Args>()...))
Invoke(MemFun&& mem_fun, Ptr&& ptr, Args&&... args) {
return ((*std::forward<Ptr>(ptr)).*
std::forward<MemFun>(mem_fun))(std::forward<Args>(args)...);
}
};
// t1.*f when N == 1 and f is a pointer to member data of a class T and t1 is
// an object of type T or a reference to an object of type T or a reference
// to an object of a type derived from T.
struct DataMemAndRef : StrippedAccept<DataMemAndRef> {
template <typename... Args>
struct AcceptImpl : std::false_type {};
template <typename R, typename C, typename Obj>
struct AcceptImpl<R C::*, Obj> : std::is_base_of<C, Obj> {};
template <typename DataMem, typename Ref>
static decltype(std::declval<Ref>().*std::declval<DataMem>()) Invoke(
DataMem&& data_mem, Ref&& ref) {
return std::forward<Ref>(ref).*std::forward<DataMem>(data_mem);
}
};
// (*t1).*f when N == 1 and f is a pointer to member data of a class T and t1
// is not one of the types described in the previous item.
struct DataMemAndPtr : StrippedAccept<DataMemAndPtr> {
template <typename... Args>
struct AcceptImpl : std::false_type {};
template <typename R, typename C, typename Ptr>
struct AcceptImpl<R C::*, Ptr>
: std::integral_constant<bool, !std::is_base_of<C, Ptr>::value> {};
template <typename DataMem, typename Ptr>
static decltype((*std::declval<Ptr>()).*std::declval<DataMem>()) Invoke(
DataMem&& data_mem, Ptr&& ptr) {
return (*std::forward<Ptr>(ptr)).*std::forward<DataMem>(data_mem);
}
};
// f(t1, t2, ..., tN) in all other cases.
struct Callable {
// Callable doesn't have Accept because it's the last clause that gets picked
// when none of the previous clauses are applicable.
template <typename F, typename... Args>
static decltype(std::declval<F>()(std::declval<Args>()...)) Invoke(
F&& f, Args&&... args) {
return std::forward<F>(f)(std::forward<Args>(args)...);
}
};
// Resolves to the first matching clause.
template <typename... Args>
struct Invoker {
typedef typename std::conditional<
MemFunAndRef::Accept<Args...>::value, MemFunAndRef,
typename std::conditional<
MemFunAndPtr::Accept<Args...>::value, MemFunAndPtr,
typename std::conditional<
DataMemAndRef::Accept<Args...>::value, DataMemAndRef,
typename std::conditional<DataMemAndPtr::Accept<Args...>::value,
DataMemAndPtr, Callable>::type>::type>::
type>::type type;
};
// The result type of Invoke<F, Args...>.
template <typename F, typename... Args>
using InvokeT = decltype(Invoker<F, Args...>::type::Invoke(
std::declval<F>(), std::declval<Args>()...));
// Invoke(f, args...) is an implementation of INVOKE(f, args...) from section
// [func.require] of the C++ standard.
template <typename F, typename... Args>
InvokeT<F, Args...> Invoke(F&& f, Args&&... args) {
return Invoker<F, Args...>::type::Invoke(std::forward<F>(f),
std::forward<Args>(args)...);
}
} // namespace base_internal
} // namespace absl
#endif // ABSL_BASE_INTERNAL_INVOKE_H_

View File

@ -1,234 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/raw_logging.h"
#include <stddef.h>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/atomic_hook.h"
#include "absl/base/log_severity.h"
// We know how to perform low-level writes to stderr in POSIX and Windows. For
// these platforms, we define the token ABSL_LOW_LEVEL_WRITE_SUPPORTED.
// Much of raw_logging.cc becomes a no-op when we can't output messages,
// although a FATAL ABSL_RAW_LOG message will still abort the process.
// ABSL_HAVE_POSIX_WRITE is defined when the platform provides posix write()
// (as from unistd.h)
//
// This preprocessor token is also defined in raw_io.cc. If you need to copy
// this, consider moving both to config.h instead.
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__Fuchsia__) || defined(__native_client__)
#include <unistd.h>
#define ABSL_HAVE_POSIX_WRITE 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
#else
#undef ABSL_HAVE_POSIX_WRITE
#endif
// ABSL_HAVE_SYSCALL_WRITE is defined when the platform provides the syscall
// syscall(SYS_write, /*int*/ fd, /*char* */ buf, /*size_t*/ len);
// for low level operations that want to avoid libc.
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
#include <sys/syscall.h>
#define ABSL_HAVE_SYSCALL_WRITE 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
#else
#undef ABSL_HAVE_SYSCALL_WRITE
#endif
#ifdef _WIN32
#include <io.h>
#define ABSL_HAVE_RAW_IO 1
#define ABSL_LOW_LEVEL_WRITE_SUPPORTED 1
#else
#undef ABSL_HAVE_RAW_IO
#endif
// TODO(gfalcon): We want raw-logging to work on as many platforms as possible.
// Explicitly #error out when not ABSL_LOW_LEVEL_WRITE_SUPPORTED, except for a
// whitelisted set of platforms for which we expect not to be able to raw log.
ABSL_CONST_INIT static absl::base_internal::AtomicHook<
absl::raw_logging_internal::LogPrefixHook> log_prefix_hook;
ABSL_CONST_INIT static absl::base_internal::AtomicHook<
absl::raw_logging_internal::AbortHook> abort_hook;
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
static const char kTruncated[] = " ... (message truncated)\n";
// sprintf the format to the buffer, adjusting *buf and *size to reflect the
// consumed bytes, and return whether the message fit without truncation. If
// truncation occurred, if possible leave room in the buffer for the message
// kTruncated[].
inline static bool VADoRawLog(char** buf, int* size, const char* format,
va_list ap) ABSL_PRINTF_ATTRIBUTE(3, 0);
inline static bool VADoRawLog(char** buf, int* size,
const char* format, va_list ap) {
int n = vsnprintf(*buf, *size, format, ap);
bool result = true;
if (n < 0 || n > *size) {
result = false;
if (static_cast<size_t>(*size) > sizeof(kTruncated)) {
n = *size - sizeof(kTruncated); // room for truncation message
} else {
n = 0; // no room for truncation message
}
}
*size -= n;
*buf += n;
return result;
}
#endif // ABSL_LOW_LEVEL_WRITE_SUPPORTED
static constexpr int kLogBufSize = 3000;
namespace {
// CAVEAT: vsnprintf called from *DoRawLog below has some (exotic) code paths
// that invoke malloc() and getenv() that might acquire some locks.
// Helper for RawLog below.
// *DoRawLog writes to *buf of *size and move them past the written portion.
// It returns true iff there was no overflow or error.
bool DoRawLog(char** buf, int* size, const char* format, ...)
ABSL_PRINTF_ATTRIBUTE(3, 4);
bool DoRawLog(char** buf, int* size, const char* format, ...) {
va_list ap;
va_start(ap, format);
int n = vsnprintf(*buf, *size, format, ap);
va_end(ap);
if (n < 0 || n > *size) return false;
*size -= n;
*buf += n;
return true;
}
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) ABSL_PRINTF_ATTRIBUTE(4, 0);
void RawLogVA(absl::LogSeverity severity, const char* file, int line,
const char* format, va_list ap) {
char buffer[kLogBufSize];
char* buf = buffer;
int size = sizeof(buffer);
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
bool enabled = true;
#else
bool enabled = false;
#endif
#ifdef ABSL_MIN_LOG_LEVEL
if (severity < static_cast<absl::LogSeverity>(ABSL_MIN_LOG_LEVEL) &&
severity < absl::LogSeverity::kFatal) {
enabled = false;
}
#endif
auto log_prefix_hook_ptr = log_prefix_hook.Load();
if (log_prefix_hook_ptr) {
enabled = log_prefix_hook_ptr(severity, file, line, &buf, &size);
} else {
if (enabled) {
DoRawLog(&buf, &size, "[%s : %d] RAW: ", file, line);
}
}
const char* const prefix_end = buf;
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
if (enabled) {
bool no_chop = VADoRawLog(&buf, &size, format, ap);
if (no_chop) {
DoRawLog(&buf, &size, "\n");
} else {
DoRawLog(&buf, &size, "%s", kTruncated);
}
absl::raw_logging_internal::SafeWriteToStderr(buffer, strlen(buffer));
}
#else
static_cast<void>(format);
static_cast<void>(ap);
#endif
// Abort the process after logging a FATAL message, even if the output itself
// was suppressed.
if (severity == absl::LogSeverity::kFatal) {
abort_hook(file, line, buffer, prefix_end, buffer + kLogBufSize);
abort();
}
}
} // namespace
namespace absl {
namespace raw_logging_internal {
void SafeWriteToStderr(const char *s, size_t len) {
#if defined(ABSL_HAVE_SYSCALL_WRITE)
syscall(SYS_write, STDERR_FILENO, s, len);
#elif defined(ABSL_HAVE_POSIX_WRITE)
write(STDERR_FILENO, s, len);
#elif defined(ABSL_HAVE_RAW_IO)
_write(/* stderr */ 2, s, len);
#else
// stderr logging unsupported on this platform
(void) s;
(void) len;
#endif
}
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) {
va_list ap;
va_start(ap, format);
RawLogVA(severity, file, line, format, ap);
va_end(ap);
}
// Non-formatting version of RawLog().
//
// TODO(gfalcon): When string_view no longer depends on base, change this
// interface to take its message as a string_view instead.
static void DefaultInternalLog(absl::LogSeverity severity, const char* file,
int line, const std::string& message) {
RawLog(severity, file, line, "%s", message.c_str());
}
bool RawLoggingFullySupported() {
#ifdef ABSL_LOW_LEVEL_WRITE_SUPPORTED
return true;
#else // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
return false;
#endif // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
}
ABSL_CONST_INIT absl::base_internal::AtomicHook<InternalLogFunction>
internal_log_function(DefaultInternalLog);
void RegisterInternalLogFunction(InternalLogFunction func) {
internal_log_function.Store(func);
}
} // namespace raw_logging_internal
} // namespace absl

View File

@ -1,180 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Thread-safe logging routines that do not allocate any memory or
// acquire any locks, and can therefore be used by low-level memory
// allocation, synchronization, and signal-handling code.
#ifndef ABSL_BASE_INTERNAL_RAW_LOGGING_H_
#define ABSL_BASE_INTERNAL_RAW_LOGGING_H_
#include <string>
#include "absl/base/attributes.h"
#include "absl/base/internal/atomic_hook.h"
#include "absl/base/log_severity.h"
#include "absl/base/macros.h"
#include "absl/base/port.h"
// This is similar to LOG(severity) << format..., but
// * it is to be used ONLY by low-level modules that can't use normal LOG()
// * it is designed to be a low-level logger that does not allocate any
// memory and does not need any locks, hence:
// * it logs straight and ONLY to STDERR w/o buffering
// * it uses an explicit printf-format and arguments list
// * it will silently chop off really long message strings
// Usage example:
// ABSL_RAW_LOG(ERROR, "Failed foo with %i: %s", status, error);
// This will print an almost standard log line like this to stderr only:
// E0821 211317 file.cc:123] RAW: Failed foo with 22: bad_file
#define ABSL_RAW_LOG(severity, ...) \
do { \
constexpr const char* absl_raw_logging_internal_basename = \
::absl::raw_logging_internal::Basename(__FILE__, \
sizeof(__FILE__) - 1); \
::absl::raw_logging_internal::RawLog(ABSL_RAW_LOGGING_INTERNAL_##severity, \
absl_raw_logging_internal_basename, \
__LINE__, __VA_ARGS__); \
} while (0)
// Similar to CHECK(condition) << message, but for low-level modules:
// we use only ABSL_RAW_LOG that does not allocate memory.
// We do not want to provide args list here to encourage this usage:
// if (!cond) ABSL_RAW_LOG(FATAL, "foo ...", hard_to_compute_args);
// so that the args are not computed when not needed.
#define ABSL_RAW_CHECK(condition, message) \
do { \
if (ABSL_PREDICT_FALSE(!(condition))) { \
ABSL_RAW_LOG(FATAL, "Check %s failed: %s", #condition, message); \
} \
} while (0)
// ABSL_INTERNAL_LOG and ABSL_INTERNAL_CHECK work like the RAW variants above,
// except that if the richer log library is linked into the binary, we dispatch
// to that instead. This is potentially useful for internal logging and
// assertions, where we are using RAW_LOG neither for its async-signal-safety
// nor for its non-allocating nature, but rather because raw logging has very
// few other dependencies.
//
// The API is a subset of the above: each macro only takes two arguments. Use
// StrCat if you need to build a richer message.
#define ABSL_INTERNAL_LOG(severity, message) \
do { \
constexpr const char* absl_raw_logging_internal_basename = \
::absl::raw_logging_internal::Basename(__FILE__, \
sizeof(__FILE__) - 1); \
::absl::raw_logging_internal::internal_log_function( \
ABSL_RAW_LOGGING_INTERNAL_##severity, \
absl_raw_logging_internal_basename, __LINE__, message); \
} while (0)
#define ABSL_INTERNAL_CHECK(condition, message) \
do { \
if (ABSL_PREDICT_FALSE(!(condition))) { \
std::string death_message = "Check " #condition " failed: "; \
death_message += std::string(message); \
ABSL_INTERNAL_LOG(FATAL, death_message); \
} \
} while (0)
#define ABSL_RAW_LOGGING_INTERNAL_INFO ::absl::LogSeverity::kInfo
#define ABSL_RAW_LOGGING_INTERNAL_WARNING ::absl::LogSeverity::kWarning
#define ABSL_RAW_LOGGING_INTERNAL_ERROR ::absl::LogSeverity::kError
#define ABSL_RAW_LOGGING_INTERNAL_FATAL ::absl::LogSeverity::kFatal
#define ABSL_RAW_LOGGING_INTERNAL_LEVEL(severity) \
::absl::NormalizeLogSeverity(severity)
namespace absl {
namespace raw_logging_internal {
// Helper function to implement ABSL_RAW_LOG
// Logs format... at "severity" level, reporting it
// as called from file:line.
// This does not allocate memory or acquire locks.
void RawLog(absl::LogSeverity severity, const char* file, int line,
const char* format, ...) ABSL_PRINTF_ATTRIBUTE(4, 5);
// Writes the provided buffer directly to stderr, in a safe, low-level manner.
//
// In POSIX this means calling write(), which is async-signal safe and does
// not malloc. If the platform supports the SYS_write syscall, we invoke that
// directly to side-step any libc interception.
void SafeWriteToStderr(const char *s, size_t len);
// compile-time function to get the "base" filename, that is, the part of
// a filename after the last "/" or "\" path separator. The search starts at
// the end of the string; the second parameter is the length of the string.
constexpr const char* Basename(const char* fname, int offset) {
return offset == 0 || fname[offset - 1] == '/' || fname[offset - 1] == '\\'
? fname + offset
: Basename(fname, offset - 1);
}
// For testing only.
// Returns true if raw logging is fully supported. When it is not
// fully supported, no messages will be emitted, but a log at FATAL
// severity will cause an abort.
//
// TODO(gfalcon): Come up with a better name for this method.
bool RawLoggingFullySupported();
// Function type for a raw_logging customization hook for suppressing messages
// by severity, and for writing custom prefixes on non-suppressed messages.
//
// The installed hook is called for every raw log invocation. The message will
// be logged to stderr only if the hook returns true. FATAL errors will cause
// the process to abort, even if writing to stderr is suppressed. The hook is
// also provided with an output buffer, where it can write a custom log message
// prefix.
//
// The raw_logging system does not allocate memory or grab locks. User-provided
// hooks must avoid these operations, and must not throw exceptions.
//
// 'severity' is the severity level of the message being written.
// 'file' and 'line' are the file and line number where the ABSL_RAW_LOG macro
// was located.
// 'buffer' and 'buf_size' are pointers to the buffer and buffer size. If the
// hook writes a prefix, it must increment *buffer and decrement *buf_size
// accordingly.
using LogPrefixHook = bool (*)(absl::LogSeverity severity, const char* file,
int line, char** buffer, int* buf_size);
// Function type for a raw_logging customization hook called to abort a process
// when a FATAL message is logged. If the provided AbortHook() returns, the
// logging system will call abort().
//
// 'file' and 'line' are the file and line number where the ABSL_RAW_LOG macro
// was located.
// The null-terminated logged message lives in the buffer between 'buf_start'
// and 'buf_end'. 'prefix_end' points to the first non-prefix character of the
// buffer (as written by the LogPrefixHook.)
using AbortHook = void (*)(const char* file, int line, const char* buf_start,
const char* prefix_end, const char* buf_end);
// Internal logging function for ABSL_INTERNAL_LOG to dispatch to.
//
// TODO(gfalcon): When string_view no longer depends on base, change this
// interface to take its message as a string_view instead.
using InternalLogFunction = void (*)(absl::LogSeverity severity,
const char* file, int line,
const std::string& message);
extern base_internal::AtomicHook<InternalLogFunction> internal_log_function;
void RegisterInternalLogFunction(InternalLogFunction func);
} // namespace raw_logging_internal
} // namespace absl
#endif // ABSL_BASE_INTERNAL_RAW_LOGGING_H_

View File

@ -1,106 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/base/internal/throw_delegate.h"
#include <cstdlib>
#include <functional>
#include <new>
#include <stdexcept>
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
namespace absl {
namespace base_internal {
namespace {
template <typename T>
[[noreturn]] void Throw(const T& error) {
#ifdef ABSL_HAVE_EXCEPTIONS
throw error;
#else
ABSL_RAW_LOG(ERROR, "%s", error.what());
abort();
#endif
}
} // namespace
void ThrowStdLogicError(const std::string& what_arg) {
Throw(std::logic_error(what_arg));
}
void ThrowStdLogicError(const char* what_arg) {
Throw(std::logic_error(what_arg));
}
void ThrowStdInvalidArgument(const std::string& what_arg) {
Throw(std::invalid_argument(what_arg));
}
void ThrowStdInvalidArgument(const char* what_arg) {
Throw(std::invalid_argument(what_arg));
}
void ThrowStdDomainError(const std::string& what_arg) {
Throw(std::domain_error(what_arg));
}
void ThrowStdDomainError(const char* what_arg) {
Throw(std::domain_error(what_arg));
}
void ThrowStdLengthError(const std::string& what_arg) {
Throw(std::length_error(what_arg));
}
void ThrowStdLengthError(const char* what_arg) {
Throw(std::length_error(what_arg));
}
void ThrowStdOutOfRange(const std::string& what_arg) {
Throw(std::out_of_range(what_arg));
}
void ThrowStdOutOfRange(const char* what_arg) {
Throw(std::out_of_range(what_arg));
}
void ThrowStdRuntimeError(const std::string& what_arg) {
Throw(std::runtime_error(what_arg));
}
void ThrowStdRuntimeError(const char* what_arg) {
Throw(std::runtime_error(what_arg));
}
void ThrowStdRangeError(const std::string& what_arg) {
Throw(std::range_error(what_arg));
}
void ThrowStdRangeError(const char* what_arg) {
Throw(std::range_error(what_arg));
}
void ThrowStdOverflowError(const std::string& what_arg) {
Throw(std::overflow_error(what_arg));
}
void ThrowStdOverflowError(const char* what_arg) {
Throw(std::overflow_error(what_arg));
}
void ThrowStdUnderflowError(const std::string& what_arg) {
Throw(std::underflow_error(what_arg));
}
void ThrowStdUnderflowError(const char* what_arg) {
Throw(std::underflow_error(what_arg));
}
void ThrowStdBadFunctionCall() { Throw(std::bad_function_call()); }
void ThrowStdBadAlloc() { Throw(std::bad_alloc()); }
} // namespace base_internal
} // namespace absl

View File

@ -1,71 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef ABSL_BASE_INTERNAL_THROW_DELEGATE_H_
#define ABSL_BASE_INTERNAL_THROW_DELEGATE_H_
#include <string>
namespace absl {
namespace base_internal {
// Helper functions that allow throwing exceptions consistently from anywhere.
// The main use case is for header-based libraries (eg templates), as they will
// be built by many different targets with their own compiler options.
// In particular, this will allow a safe way to throw exceptions even if the
// caller is compiled with -fno-exceptions. This is intended for implementing
// things like map<>::at(), which the standard documents as throwing an
// exception on error.
//
// Using other techniques like #if tricks could lead to ODR violations.
//
// You shouldn't use it unless you're writing code that you know will be built
// both with and without exceptions and you need to conform to an interface
// that uses exceptions.
[[noreturn]] void ThrowStdLogicError(const std::string& what_arg);
[[noreturn]] void ThrowStdLogicError(const char* what_arg);
[[noreturn]] void ThrowStdInvalidArgument(const std::string& what_arg);
[[noreturn]] void ThrowStdInvalidArgument(const char* what_arg);
[[noreturn]] void ThrowStdDomainError(const std::string& what_arg);
[[noreturn]] void ThrowStdDomainError(const char* what_arg);
[[noreturn]] void ThrowStdLengthError(const std::string& what_arg);
[[noreturn]] void ThrowStdLengthError(const char* what_arg);
[[noreturn]] void ThrowStdOutOfRange(const std::string& what_arg);
[[noreturn]] void ThrowStdOutOfRange(const char* what_arg);
[[noreturn]] void ThrowStdRuntimeError(const std::string& what_arg);
[[noreturn]] void ThrowStdRuntimeError(const char* what_arg);
[[noreturn]] void ThrowStdRangeError(const std::string& what_arg);
[[noreturn]] void ThrowStdRangeError(const char* what_arg);
[[noreturn]] void ThrowStdOverflowError(const std::string& what_arg);
[[noreturn]] void ThrowStdOverflowError(const char* what_arg);
[[noreturn]] void ThrowStdUnderflowError(const std::string& what_arg);
[[noreturn]] void ThrowStdUnderflowError(const char* what_arg);
[[noreturn]] void ThrowStdBadFunctionCall();
[[noreturn]] void ThrowStdBadAlloc();
// ThrowStdBadArrayNewLength() cannot be consistently supported because
// std::bad_array_new_length is missing in libstdc++ until 4.9.0.
// https://gcc.gnu.org/onlinedocs/gcc-4.8.3/libstdc++/api/a01379_source.html
// https://gcc.gnu.org/onlinedocs/gcc-4.9.0/libstdc++/api/a01327_source.html
// libcxx (as of 3.2) and msvc (as of 2015) both have it.
// [[noreturn]] void ThrowStdBadArrayNewLength();
} // namespace base_internal
} // namespace absl
#endif // ABSL_BASE_INTERNAL_THROW_DELEGATE_H_

View File

@ -1,67 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
#define ABSL_BASE_INTERNAL_LOG_SEVERITY_H_
#include <array>
#include "absl/base/attributes.h"
namespace absl {
// Four severity levels are defined. Logging APIs should terminate the program
// when a message is logged at severity `kFatal`; the other levels have no
// special semantics.
enum class LogSeverity : int {
kInfo = 0,
kWarning = 1,
kError = 2,
kFatal = 3,
};
// Returns an iterable of all standard `absl::LogSeverity` values, ordered from
// least to most severe.
constexpr std::array<absl::LogSeverity, 4> LogSeverities() {
return {{absl::LogSeverity::kInfo, absl::LogSeverity::kWarning,
absl::LogSeverity::kError, absl::LogSeverity::kFatal}};
}
// Returns the all-caps string representation (e.g. "INFO") of the specified
// severity level if it is one of the normal levels and "UNKNOWN" otherwise.
constexpr const char* LogSeverityName(absl::LogSeverity s) {
return s == absl::LogSeverity::kInfo
? "INFO"
: s == absl::LogSeverity::kWarning
? "WARNING"
: s == absl::LogSeverity::kError
? "ERROR"
: s == absl::LogSeverity::kFatal ? "FATAL" : "UNKNOWN";
}
// Values less than `kInfo` normalize to `kInfo`; values greater than `kFatal`
// normalize to `kError` (**NOT** `kFatal`).
constexpr absl::LogSeverity NormalizeLogSeverity(absl::LogSeverity s) {
return s < absl::LogSeverity::kInfo
? absl::LogSeverity::kInfo
: s > absl::LogSeverity::kFatal ? absl::LogSeverity::kError : s;
}
constexpr absl::LogSeverity NormalizeLogSeverity(int s) {
return NormalizeLogSeverity(static_cast<absl::LogSeverity>(s));
}
} // namespace absl
#endif // ABSL_BASE_INTERNAL_LOG_SEVERITY_H_

View File

@ -1,212 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: macros.h
// -----------------------------------------------------------------------------
//
// This header file defines the set of language macros used within Abseil code.
// For the set of macros used to determine supported compilers and platforms,
// see absl/base/config.h instead.
//
// This code is compiled directly on many platforms, including client
// platforms like Windows, Mac, and embedded systems. Before making
// any changes here, make sure that you're not breaking any platforms.
//
#ifndef ABSL_BASE_MACROS_H_
#define ABSL_BASE_MACROS_H_
#include <cassert>
#include <cstddef>
#include "absl/base/port.h"
// ABSL_ARRAYSIZE()
//
// Returns the number of elements in an array as a compile-time constant, which
// can be used in defining new arrays. If you use this macro on a pointer by
// mistake, you will get a compile-time error.
#define ABSL_ARRAYSIZE(array) \
(sizeof(::absl::macros_internal::ArraySizeHelper(array)))
namespace absl {
namespace macros_internal {
// Note: this internal template function declaration is used by ABSL_ARRAYSIZE.
// The function doesn't need a definition, as we only use its type.
template <typename T, size_t N>
auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
} // namespace macros_internal
} // namespace absl
// kLinkerInitialized
//
// An enum used only as a constructor argument to indicate that a variable has
// static storage duration, and that the constructor should do nothing to its
// state. Use of this macro indicates to the reader that it is legal to
// declare a static instance of the class, provided the constructor is given
// the absl::base_internal::kLinkerInitialized argument.
//
// Normally, it is unsafe to declare a static variable that has a constructor or
// a destructor because invocation order is undefined. However, if the type can
// be zero-initialized (which the loader does for static variables) into a valid
// state and the type's destructor does not affect storage, then a constructor
// for static initialization can be declared.
//
// Example:
// // Declaration
// explicit MyClass(absl::base_internal:LinkerInitialized x) {}
//
// // Invocation
// static MyClass my_global(absl::base_internal::kLinkerInitialized);
namespace absl {
namespace base_internal {
enum LinkerInitialized {
kLinkerInitialized = 0,
};
} // namespace base_internal
} // namespace absl
// ABSL_FALLTHROUGH_INTENDED
//
// Annotates implicit fall-through between switch labels, allowing a case to
// indicate intentional fallthrough and turn off warnings about any lack of a
// `break` statement. The ABSL_FALLTHROUGH_INTENDED macro should be followed by
// a semicolon and can be used in most places where `break` can, provided that
// no statements exist between it and the next switch label.
//
// Example:
//
// switch (x) {
// case 40:
// case 41:
// if (truth_is_out_there) {
// ++x;
// ABSL_FALLTHROUGH_INTENDED; // Use instead of/along with annotations
// // in comments
// } else {
// return x;
// }
// case 42:
// ...
//
// Notes: when compiled with clang in C++11 mode, the ABSL_FALLTHROUGH_INTENDED
// macro is expanded to the [[clang::fallthrough]] attribute, which is analysed
// when performing switch labels fall-through diagnostic
// (`-Wimplicit-fallthrough`). See clang documentation on language extensions
// for details:
// http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
//
// When used with unsupported compilers, the ABSL_FALLTHROUGH_INTENDED macro
// has no effect on diagnostics. In any case this macro has no effect on runtime
// behavior and performance of code.
#ifdef ABSL_FALLTHROUGH_INTENDED
#error "ABSL_FALLTHROUGH_INTENDED should not be defined."
#endif
// TODO(zhangxy): Use c++17 standard [[fallthrough]] macro, when supported.
#if defined(__clang__) && defined(__has_warning)
#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define ABSL_FALLTHROUGH_INTENDED [[clang::fallthrough]]
#endif
#elif defined(__GNUC__) && __GNUC__ >= 7
#define ABSL_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
#endif
#ifndef ABSL_FALLTHROUGH_INTENDED
#define ABSL_FALLTHROUGH_INTENDED \
do { \
} while (0)
#endif
// ABSL_DEPRECATED()
//
// Marks a deprecated class, struct, enum, function, method and variable
// declarations. The macro argument is used as a custom diagnostic message (e.g.
// suggestion of a better alternative).
//
// Example:
//
// class ABSL_DEPRECATED("Use Bar instead") Foo {...};
// ABSL_DEPRECATED("Use Baz instead") void Bar() {...}
//
// Every usage of a deprecated entity will trigger a warning when compiled with
// clang's `-Wdeprecated-declarations` option. This option is turned off by
// default, but the warnings will be reported by clang-tidy.
#if defined(__clang__) && __cplusplus >= 201103L
#define ABSL_DEPRECATED(message) __attribute__((deprecated(message)))
#endif
#ifndef ABSL_DEPRECATED
#define ABSL_DEPRECATED(message)
#endif
// ABSL_BAD_CALL_IF()
//
// Used on a function overload to trap bad calls: any call that matches the
// overload will cause a compile-time error. This macro uses a clang-specific
// "enable_if" attribute, as described at
// http://clang.llvm.org/docs/AttributeReference.html#enable-if
//
// Overloads which use this macro should be bracketed by
// `#ifdef ABSL_BAD_CALL_IF`.
//
// Example:
//
// int isdigit(int c);
// #ifdef ABSL_BAD_CALL_IF
// int isdigit(int c)
// ABSL_BAD_CALL_IF(c <= -1 || c > 255,
// "'c' must have the value of an unsigned char or EOF");
// #endif // ABSL_BAD_CALL_IF
#if defined(__clang__)
# if __has_attribute(enable_if)
# define ABSL_BAD_CALL_IF(expr, msg) \
__attribute__((enable_if(expr, "Bad call trap"), unavailable(msg)))
# endif
#endif
// ABSL_ASSERT()
//
// In C++11, `assert` can't be used portably within constexpr functions.
// ABSL_ASSERT functions as a runtime assert but works in C++11 constexpr
// functions. Example:
//
// constexpr double Divide(double a, double b) {
// return ABSL_ASSERT(b != 0), a / b;
// }
//
// This macro is inspired by
// https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/
#if defined(NDEBUG)
#define ABSL_ASSERT(expr) (false ? (void)(expr) : (void)0)
#else
#define ABSL_ASSERT(expr) \
(ABSL_PREDICT_TRUE((expr)) ? (void)0 \
: [] { assert(false && #expr); }()) // NOLINT
#endif
#ifdef ABSL_HAVE_EXCEPTIONS
#define ABSL_INTERNAL_TRY try
#define ABSL_INTERNAL_CATCH_ANY catch (...)
#define ABSL_INTERNAL_RETHROW do { throw; } while (false)
#else // ABSL_HAVE_EXCEPTIONS
#define ABSL_INTERNAL_TRY if (true)
#define ABSL_INTERNAL_CATCH_ANY else if (false)
#define ABSL_INTERNAL_RETHROW do {} while (false)
#endif // ABSL_HAVE_EXCEPTIONS
#endif // ABSL_BASE_MACROS_H_

View File

@ -1,165 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: optimization.h
// -----------------------------------------------------------------------------
//
// This header file defines portable macros for performance optimization.
#ifndef ABSL_BASE_OPTIMIZATION_H_
#define ABSL_BASE_OPTIMIZATION_H_
#include "absl/base/config.h"
// ABSL_BLOCK_TAIL_CALL_OPTIMIZATION
//
// Instructs the compiler to avoid optimizing tail-call recursion. Use of this
// macro is useful when you wish to preserve the existing function order within
// a stack trace for logging, debugging, or profiling purposes.
//
// Example:
//
// int f() {
// int result = g();
// ABSL_BLOCK_TAIL_CALL_OPTIMIZATION();
// return result;
// }
#if defined(__pnacl__)
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; }
#elif defined(__clang__)
// Clang will not tail call given inline volatile assembly.
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
#elif defined(__GNUC__)
// GCC will not tail call given inline volatile assembly.
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
#elif defined(_MSC_VER)
#include <intrin.h>
// The __nop() intrinsic blocks the optimisation.
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __nop()
#else
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; }
#endif
// ABSL_CACHELINE_SIZE
//
// Explicitly defines the size of the L1 cache for purposes of alignment.
// Setting the cacheline size allows you to specify that certain objects be
// aligned on a cacheline boundary with `ABSL_CACHELINE_ALIGNED` declarations.
// (See below.)
//
// NOTE: this macro should be replaced with the following C++17 features, when
// those are generally available:
//
// * `std::hardware_constructive_interference_size`
// * `std::hardware_destructive_interference_size`
//
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
// for more information.
#if defined(__GNUC__)
// Cache line alignment
#if defined(__i386__) || defined(__x86_64__)
#define ABSL_CACHELINE_SIZE 64
#elif defined(__powerpc64__)
#define ABSL_CACHELINE_SIZE 128
#elif defined(__aarch64__)
// We would need to read special register ctr_el0 to find out L1 dcache size.
// This value is a good estimate based on a real aarch64 machine.
#define ABSL_CACHELINE_SIZE 64
#elif defined(__arm__)
// Cache line sizes for ARM: These values are not strictly correct since
// cache line sizes depend on implementations, not architectures. There
// are even implementations with cache line sizes configurable at boot
// time.
#if defined(__ARM_ARCH_5T__)
#define ABSL_CACHELINE_SIZE 32
#elif defined(__ARM_ARCH_7A__)
#define ABSL_CACHELINE_SIZE 64
#endif
#endif
#ifndef ABSL_CACHELINE_SIZE
// A reasonable default guess. Note that overestimates tend to waste more
// space, while underestimates tend to waste more time.
#define ABSL_CACHELINE_SIZE 64
#endif
// ABSL_CACHELINE_ALIGNED
//
// Indicates that the declared object be cache aligned using
// `ABSL_CACHELINE_SIZE` (see above). Cacheline aligning objects allows you to
// load a set of related objects in the L1 cache for performance improvements.
// Cacheline aligning objects properly allows constructive memory sharing and
// prevents destructive (or "false") memory sharing.
//
// NOTE: this macro should be replaced with usage of `alignas()` using
// `std::hardware_constructive_interference_size` and/or
// `std::hardware_destructive_interference_size` when available within C++17.
//
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
// for more information.
//
// On some compilers, `ABSL_CACHELINE_ALIGNED` expands to
// `__attribute__((aligned(ABSL_CACHELINE_SIZE)))`. For compilers where this is
// not known to work, the macro expands to nothing.
//
// No further guarantees are made here. The result of applying the macro
// to variables and types is always implementation-defined.
//
// WARNING: It is easy to use this attribute incorrectly, even to the point
// of causing bugs that are difficult to diagnose, crash, etc. It does not
// of itself guarantee that objects are aligned to a cache line.
//
// Recommendations:
//
// 1) Consult compiler documentation; this comment is not kept in sync as
// toolchains evolve.
// 2) Verify your use has the intended effect. This often requires inspecting
// the generated machine code.
// 3) Prefer applying this attribute to individual variables. Avoid
// applying it to types. This tends to localize the effect.
#define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE)))
#else // not GCC
#define ABSL_CACHELINE_SIZE 64
#define ABSL_CACHELINE_ALIGNED
#endif
// ABSL_PREDICT_TRUE, ABSL_PREDICT_FALSE
//
// Enables the compiler to prioritize compilation using static analysis for
// likely paths within a boolean branch.
//
// Example:
//
// if (ABSL_PREDICT_TRUE(expression)) {
// return result; // Faster if more likely
// } else {
// return 0;
// }
//
// Compilers can use the information that a certain branch is not likely to be
// taken (for instance, a CHECK failure) to optimize for the common case in
// the absence of better information (ie. compiling gcc with `-fprofile-arcs`).
#if ABSL_HAVE_BUILTIN(__builtin_expect) || \
(defined(__GNUC__) && !defined(__clang__))
#define ABSL_PREDICT_FALSE(x) (__builtin_expect(x, 0))
#define ABSL_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#else
#define ABSL_PREDICT_FALSE(x) (x)
#define ABSL_PREDICT_TRUE(x) (x)
#endif
#endif // ABSL_BASE_OPTIMIZATION_H_

View File

@ -1,121 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: policy_checks.h
// -----------------------------------------------------------------------------
//
// This header enforces a minimum set of policies at build time, such as the
// supported compiler and library versions. Unsupported configurations are
// reported with `#error`. This enforcement is best effort, so successfully
// compiling this header does not guarantee a supported configuration.
#ifndef ABSL_BASE_POLICY_CHECKS_H_
#define ABSL_BASE_POLICY_CHECKS_H_
// Included for the __GLIBC_PREREQ macro used below.
#include <limits.h>
// Included for the _STLPORT_VERSION macro used below.
#if defined(__cplusplus)
#include <cstddef>
#endif
// -----------------------------------------------------------------------------
// Operating System Check
// -----------------------------------------------------------------------------
#if defined(__CYGWIN__)
#error "Cygwin is not supported."
#endif
// -----------------------------------------------------------------------------
// Compiler Check
// -----------------------------------------------------------------------------
// We support MSVC++ 14.0 update 2 and later.
// This minimum will go up.
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023918 && !defined(__clang__)
#error "This package requires Visual Studio 2015 Update 2 or higher."
#endif
// We support gcc 4.7 and later.
// This minimum will go up.
#if defined(__GNUC__) && !defined(__clang__)
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
#error "This package requires gcc 4.7 or higher."
#endif
#endif
// We support Apple Xcode clang 4.2.1 (version 421.11.65) and later.
// This corresponds to Apple Xcode version 4.5.
// This minimum will go up.
#if defined(__apple_build_version__) && __apple_build_version__ < 4211165
#error "This package requires __apple_build_version__ of 4211165 or higher."
#endif
// -----------------------------------------------------------------------------
// C++ Version Check
// -----------------------------------------------------------------------------
// Enforce C++11 as the minimum. Note that Visual Studio has not
// advanced __cplusplus despite being good enough for our purposes, so
// so we exempt it from the check.
#if defined(__cplusplus) && !defined(_MSC_VER)
#if __cplusplus < 201103L
#error "C++ versions less than C++11 are not supported."
#endif
#endif
// -----------------------------------------------------------------------------
// Standard Library Check
// -----------------------------------------------------------------------------
// We have chosen glibc 2.12 as the minimum as it was tagged for release
// in May, 2010 and includes some functionality used in Google software
// (for instance pthread_setname_np):
// https://sourceware.org/ml/libc-alpha/2010-05/msg00000.html
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
#if !__GLIBC_PREREQ(2, 12)
#error "Minimum required version of glibc is 2.12."
#endif
#endif
#if defined(_STLPORT_VERSION)
#error "STLPort is not supported."
#endif
// -----------------------------------------------------------------------------
// `char` Size Check
// -----------------------------------------------------------------------------
// Abseil currently assumes CHAR_BIT == 8. If you would like to use Abseil on a
// platform where this is not the case, please provide us with the details about
// your platform so we can consider relaxing this requirement.
#if CHAR_BIT != 8
#error "Abseil assumes CHAR_BIT == 8."
#endif
// -----------------------------------------------------------------------------
// `int` Size Check
// -----------------------------------------------------------------------------
// Abseil currently assumes that an int is 4 bytes. If you would like to use
// Abseil on a platform where this is not the case, please provide us with the
// details about your platform so we can consider relaxing this requirement.
#if INT_MAX < 2147483647
#error "Abseil assumes that int is at least 4 bytes. "
#endif
#endif // ABSL_BASE_POLICY_CHECKS_H_

View File

@ -1,26 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This files is a forwarding header for other headers containing various
// portability macros and functions.
// This file is used for both C and C++!
#ifndef ABSL_BASE_PORT_H_
#define ABSL_BASE_PORT_H_
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/optimization.h"
#endif // ABSL_BASE_PORT_H_

View File

@ -1,697 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: memory.h
// -----------------------------------------------------------------------------
//
// This header file contains utility functions for managing the creation and
// conversion of smart pointers. This file is an extension to the C++
// standard <memory> library header file.
#ifndef ABSL_MEMORY_MEMORY_H_
#define ABSL_MEMORY_MEMORY_H_
#include <cstddef>
#include <limits>
#include <memory>
#include <new>
#include <type_traits>
#include <utility>
#include "absl/base/macros.h"
#include "absl/meta/type_traits.h"
namespace absl {
// -----------------------------------------------------------------------------
// Function Template: WrapUnique()
// -----------------------------------------------------------------------------
//
// Adopts ownership from a raw pointer and transfers it to the returned
// `std::unique_ptr`, whose type is deduced. Because of this deduction, *do not*
// specify the template type `T` when calling `WrapUnique`.
//
// Example:
// X* NewX(int, int);
// auto x = WrapUnique(NewX(1, 2)); // 'x' is std::unique_ptr<X>.
//
// The purpose of WrapUnique is to automatically deduce the pointer type. If you
// wish to make the type explicit, for readability reasons or because you prefer
// to use a base-class pointer rather than a derived one, just use
// `std::unique_ptr` directly.
//
// Example:
// X* Factory(int, int);
// auto x = std::unique_ptr<X>(Factory(1, 2));
// - or -
// std::unique_ptr<X> x(Factory(1, 2));
//
// This has the added advantage of working whether Factory returns a raw
// pointer or a `std::unique_ptr`.
//
// While `absl::WrapUnique` is useful for capturing the output of a raw
// pointer factory, prefer 'absl::make_unique<T>(args...)' over
// 'absl::WrapUnique(new T(args...))'.
//
// auto x = WrapUnique(new X(1, 2)); // works, but nonideal.
// auto x = make_unique<X>(1, 2); // safer, standard, avoids raw 'new'.
//
// Note that `absl::WrapUnique(p)` is valid only if `delete p` is a valid
// expression. In particular, `absl::WrapUnique()` cannot wrap pointers to
// arrays, functions or void, and it must not be used to capture pointers
// obtained from array-new expressions (even though that would compile!).
template <typename T>
std::unique_ptr<T> WrapUnique(T* ptr) {
static_assert(!std::is_array<T>::value, "array types are unsupported");
static_assert(std::is_object<T>::value, "non-object types are unsupported");
return std::unique_ptr<T>(ptr);
}
namespace memory_internal {
// Traits to select proper overload and return type for `absl::make_unique<>`.
template <typename T>
struct MakeUniqueResult {
using scalar = std::unique_ptr<T>;
};
template <typename T>
struct MakeUniqueResult<T[]> {
using array = std::unique_ptr<T[]>;
};
template <typename T, size_t N>
struct MakeUniqueResult<T[N]> {
using invalid = void;
};
} // namespace memory_internal
// gcc 4.8 has __cplusplus at 201301 but doesn't define make_unique. Other
// supported compilers either just define __cplusplus as 201103 but have
// make_unique (msvc), or have make_unique whenever __cplusplus > 201103 (clang)
#if (__cplusplus > 201103L || defined(_MSC_VER)) && \
!(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8)
using std::make_unique;
#else
// -----------------------------------------------------------------------------
// Function Template: make_unique<T>()
// -----------------------------------------------------------------------------
//
// Creates a `std::unique_ptr<>`, while avoiding issues creating temporaries
// during the construction process. `absl::make_unique<>` also avoids redundant
// type declarations, by avoiding the need to explicitly use the `new` operator.
//
// This implementation of `absl::make_unique<>` is designed for C++11 code and
// will be replaced in C++14 by the equivalent `std::make_unique<>` abstraction.
// `absl::make_unique<>` is designed to be 100% compatible with
// `std::make_unique<>` so that the eventual migration will involve a simple
// rename operation.
//
// For more background on why `std::unique_ptr<T>(new T(a,b))` is problematic,
// see Herb Sutter's explanation on
// (Exception-Safe Function Calls)[http://herbsutter.com/gotw/_102/].
// (In general, reviewers should treat `new T(a,b)` with scrutiny.)
//
// Example usage:
//
// auto p = make_unique<X>(args...); // 'p' is a std::unique_ptr<X>
// auto pa = make_unique<X[]>(5); // 'pa' is a std::unique_ptr<X[]>
//
// Three overloads of `absl::make_unique` are required:
//
// - For non-array T:
//
// Allocates a T with `new T(std::forward<Args> args...)`,
// forwarding all `args` to T's constructor.
// Returns a `std::unique_ptr<T>` owning that object.
//
// - For an array of unknown bounds T[]:
//
// `absl::make_unique<>` will allocate an array T of type U[] with
// `new U[n]()` and return a `std::unique_ptr<U[]>` owning that array.
//
// Note that 'U[n]()' is different from 'U[n]', and elements will be
// value-initialized. Note as well that `std::unique_ptr` will perform its
// own destruction of the array elements upon leaving scope, even though
// the array [] does not have a default destructor.
//
// NOTE: an array of unknown bounds T[] may still be (and often will be)
// initialized to have a size, and will still use this overload. E.g:
//
// auto my_array = absl::make_unique<int[]>(10);
//
// - For an array of known bounds T[N]:
//
// `absl::make_unique<>` is deleted (like with `std::make_unique<>`) as
// this overload is not useful.
//
// NOTE: an array of known bounds T[N] is not considered a useful
// construction, and may cause undefined behavior in templates. E.g:
//
// auto my_array = absl::make_unique<int[10]>();
//
// In those cases, of course, you can still use the overload above and
// simply initialize it to its desired size:
//
// auto my_array = absl::make_unique<int[]>(10);
// `absl::make_unique` overload for non-array types.
template <typename T, typename... Args>
typename memory_internal::MakeUniqueResult<T>::scalar make_unique(
Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
// `absl::make_unique` overload for an array T[] of unknown bounds.
// The array allocation needs to use the `new T[size]` form and cannot take
// element constructor arguments. The `std::unique_ptr` will manage destructing
// these array elements.
template <typename T>
typename memory_internal::MakeUniqueResult<T>::array make_unique(size_t n) {
return std::unique_ptr<T>(new typename absl::remove_extent_t<T>[n]());
}
// `absl::make_unique` overload for an array T[N] of known bounds.
// This construction will be rejected.
template <typename T, typename... Args>
typename memory_internal::MakeUniqueResult<T>::invalid make_unique(
Args&&... /* args */) = delete;
#endif
// -----------------------------------------------------------------------------
// Function Template: RawPtr()
// -----------------------------------------------------------------------------
//
// Extracts the raw pointer from a pointer-like value `ptr`. `absl::RawPtr` is
// useful within templates that need to handle a complement of raw pointers,
// `std::nullptr_t`, and smart pointers.
template <typename T>
auto RawPtr(T&& ptr) -> decltype(std::addressof(*ptr)) {
// ptr is a forwarding reference to support Ts with non-const operators.
return (ptr != nullptr) ? std::addressof(*ptr) : nullptr;
}
inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; }
// -----------------------------------------------------------------------------
// Function Template: ShareUniquePtr()
// -----------------------------------------------------------------------------
//
// Adopts a `std::unique_ptr` rvalue and returns a `std::shared_ptr` of deduced
// type. Ownership (if any) of the held value is transferred to the returned
// shared pointer.
//
// Example:
//
// auto up = absl::make_unique<int>(10);
// auto sp = absl::ShareUniquePtr(std::move(up)); // shared_ptr<int>
// CHECK_EQ(*sp, 10);
// CHECK(up == nullptr);
//
// Note that this conversion is correct even when T is an array type, and more
// generally it works for *any* deleter of the `unique_ptr` (single-object
// deleter, array deleter, or any custom deleter), since the deleter is adopted
// by the shared pointer as well. The deleter is copied (unless it is a
// reference).
//
// Implements the resolution of [LWG 2415](http://wg21.link/lwg2415), by which a
// null shared pointer does not attempt to call the deleter.
template <typename T, typename D>
std::shared_ptr<T> ShareUniquePtr(std::unique_ptr<T, D>&& ptr) {
return ptr ? std::shared_ptr<T>(std::move(ptr)) : std::shared_ptr<T>();
}
// -----------------------------------------------------------------------------
// Function Template: WeakenPtr()
// -----------------------------------------------------------------------------
//
// Creates a weak pointer associated with a given shared pointer. The returned
// value is a `std::weak_ptr` of deduced type.
//
// Example:
//
// auto sp = std::make_shared<int>(10);
// auto wp = absl::WeakenPtr(sp);
// CHECK_EQ(sp.get(), wp.lock().get());
// sp.reset();
// CHECK(wp.lock() == nullptr);
//
template <typename T>
std::weak_ptr<T> WeakenPtr(const std::shared_ptr<T>& ptr) {
return std::weak_ptr<T>(ptr);
}
namespace memory_internal {
// ExtractOr<E, O, D>::type evaluates to E<O> if possible. Otherwise, D.
template <template <typename> class Extract, typename Obj, typename Default,
typename>
struct ExtractOr {
using type = Default;
};
template <template <typename> class Extract, typename Obj, typename Default>
struct ExtractOr<Extract, Obj, Default, void_t<Extract<Obj>>> {
using type = Extract<Obj>;
};
template <template <typename> class Extract, typename Obj, typename Default>
using ExtractOrT = typename ExtractOr<Extract, Obj, Default, void>::type;
// Extractors for the features of allocators.
template <typename T>
using GetPointer = typename T::pointer;
template <typename T>
using GetConstPointer = typename T::const_pointer;
template <typename T>
using GetVoidPointer = typename T::void_pointer;
template <typename T>
using GetConstVoidPointer = typename T::const_void_pointer;
template <typename T>
using GetDifferenceType = typename T::difference_type;
template <typename T>
using GetSizeType = typename T::size_type;
template <typename T>
using GetPropagateOnContainerCopyAssignment =
typename T::propagate_on_container_copy_assignment;
template <typename T>
using GetPropagateOnContainerMoveAssignment =
typename T::propagate_on_container_move_assignment;
template <typename T>
using GetPropagateOnContainerSwap = typename T::propagate_on_container_swap;
template <typename T>
using GetIsAlwaysEqual = typename T::is_always_equal;
template <typename T>
struct GetFirstArg;
template <template <typename...> class Class, typename T, typename... Args>
struct GetFirstArg<Class<T, Args...>> {
using type = T;
};
template <typename Ptr, typename = void>
struct ElementType {
using type = typename GetFirstArg<Ptr>::type;
};
template <typename T>
struct ElementType<T, void_t<typename T::element_type>> {
using type = typename T::element_type;
};
template <typename T, typename U>
struct RebindFirstArg;
template <template <typename...> class Class, typename T, typename... Args,
typename U>
struct RebindFirstArg<Class<T, Args...>, U> {
using type = Class<U, Args...>;
};
template <typename T, typename U, typename = void>
struct RebindPtr {
using type = typename RebindFirstArg<T, U>::type;
};
template <typename T, typename U>
struct RebindPtr<T, U, void_t<typename T::template rebind<U>>> {
using type = typename T::template rebind<U>;
};
template <typename T, typename U>
constexpr bool HasRebindAlloc(...) {
return false;
}
template <typename T, typename U>
constexpr bool HasRebindAlloc(typename T::template rebind<U>::other*) {
return true;
}
template <typename T, typename U, bool = HasRebindAlloc<T, U>(nullptr)>
struct RebindAlloc {
using type = typename RebindFirstArg<T, U>::type;
};
template <typename T, typename U>
struct RebindAlloc<T, U, true> {
using type = typename T::template rebind<U>::other;
};
} // namespace memory_internal
// -----------------------------------------------------------------------------
// Class Template: pointer_traits
// -----------------------------------------------------------------------------
//
// An implementation of C++11's std::pointer_traits.
//
// Provided for portability on toolchains that have a working C++11 compiler,
// but the standard library is lacking in C++11 support. For example, some
// version of the Android NDK.
//
template <typename Ptr>
struct pointer_traits {
using pointer = Ptr;
// element_type:
// Ptr::element_type if present. Otherwise T if Ptr is a template
// instantiation Template<T, Args...>
using element_type = typename memory_internal::ElementType<Ptr>::type;
// difference_type:
// Ptr::difference_type if present, otherwise std::ptrdiff_t
using difference_type =
memory_internal::ExtractOrT<memory_internal::GetDifferenceType, Ptr,
std::ptrdiff_t>;
// rebind:
// Ptr::rebind<U> if exists, otherwise Template<U, Args...> if Ptr is a
// template instantiation Template<T, Args...>
template <typename U>
using rebind = typename memory_internal::RebindPtr<Ptr, U>::type;
// pointer_to:
// Calls Ptr::pointer_to(r)
static pointer pointer_to(element_type& r) { // NOLINT(runtime/references)
return Ptr::pointer_to(r);
}
};
// Specialization for T*.
template <typename T>
struct pointer_traits<T*> {
using pointer = T*;
using element_type = T;
using difference_type = std::ptrdiff_t;
template <typename U>
using rebind = U*;
// pointer_to:
// Calls std::addressof(r)
static pointer pointer_to(
element_type& r) noexcept { // NOLINT(runtime/references)
return std::addressof(r);
}
};
// -----------------------------------------------------------------------------
// Class Template: allocator_traits
// -----------------------------------------------------------------------------
//
// A C++11 compatible implementation of C++17's std::allocator_traits.
//
template <typename Alloc>
struct allocator_traits {
using allocator_type = Alloc;
// value_type:
// Alloc::value_type
using value_type = typename Alloc::value_type;
// pointer:
// Alloc::pointer if present, otherwise value_type*
using pointer = memory_internal::ExtractOrT<memory_internal::GetPointer,
Alloc, value_type*>;
// const_pointer:
// Alloc::const_pointer if present, otherwise
// absl::pointer_traits<pointer>::rebind<const value_type>
using const_pointer =
memory_internal::ExtractOrT<memory_internal::GetConstPointer, Alloc,
typename absl::pointer_traits<pointer>::
template rebind<const value_type>>;
// void_pointer:
// Alloc::void_pointer if present, otherwise
// absl::pointer_traits<pointer>::rebind<void>
using void_pointer = memory_internal::ExtractOrT<
memory_internal::GetVoidPointer, Alloc,
typename absl::pointer_traits<pointer>::template rebind<void>>;
// const_void_pointer:
// Alloc::const_void_pointer if present, otherwise
// absl::pointer_traits<pointer>::rebind<const void>
using const_void_pointer = memory_internal::ExtractOrT<
memory_internal::GetConstVoidPointer, Alloc,
typename absl::pointer_traits<pointer>::template rebind<const void>>;
// difference_type:
// Alloc::difference_type if present, otherwise
// absl::pointer_traits<pointer>::difference_type
using difference_type = memory_internal::ExtractOrT<
memory_internal::GetDifferenceType, Alloc,
typename absl::pointer_traits<pointer>::difference_type>;
// size_type:
// Alloc::size_type if present, otherwise
// std::make_unsigned<difference_type>::type
using size_type = memory_internal::ExtractOrT<
memory_internal::GetSizeType, Alloc,
typename std::make_unsigned<difference_type>::type>;
// propagate_on_container_copy_assignment:
// Alloc::propagate_on_container_copy_assignment if present, otherwise
// std::false_type
using propagate_on_container_copy_assignment = memory_internal::ExtractOrT<
memory_internal::GetPropagateOnContainerCopyAssignment, Alloc,
std::false_type>;
// propagate_on_container_move_assignment:
// Alloc::propagate_on_container_move_assignment if present, otherwise
// std::false_type
using propagate_on_container_move_assignment = memory_internal::ExtractOrT<
memory_internal::GetPropagateOnContainerMoveAssignment, Alloc,
std::false_type>;
// propagate_on_container_swap:
// Alloc::propagate_on_container_swap if present, otherwise std::false_type
using propagate_on_container_swap =
memory_internal::ExtractOrT<memory_internal::GetPropagateOnContainerSwap,
Alloc, std::false_type>;
// is_always_equal:
// Alloc::is_always_equal if present, otherwise std::is_empty<Alloc>::type
using is_always_equal =
memory_internal::ExtractOrT<memory_internal::GetIsAlwaysEqual, Alloc,
typename std::is_empty<Alloc>::type>;
// rebind_alloc:
// Alloc::rebind<T>::other if present, otherwise Alloc<T, Args> if this Alloc
// is Alloc<U, Args>
template <typename T>
using rebind_alloc = typename memory_internal::RebindAlloc<Alloc, T>::type;
// rebind_traits:
// absl::allocator_traits<rebind_alloc<T>>
template <typename T>
using rebind_traits = absl::allocator_traits<rebind_alloc<T>>;
// allocate(Alloc& a, size_type n):
// Calls a.allocate(n)
static pointer allocate(Alloc& a, // NOLINT(runtime/references)
size_type n) {
return a.allocate(n);
}
// allocate(Alloc& a, size_type n, const_void_pointer hint):
// Calls a.allocate(n, hint) if possible.
// If not possible, calls a.allocate(n)
static pointer allocate(Alloc& a, size_type n, // NOLINT(runtime/references)
const_void_pointer hint) {
return allocate_impl(0, a, n, hint);
}
// deallocate(Alloc& a, pointer p, size_type n):
// Calls a.deallocate(p, n)
static void deallocate(Alloc& a, pointer p, // NOLINT(runtime/references)
size_type n) {
a.deallocate(p, n);
}
// construct(Alloc& a, T* p, Args&&... args):
// Calls a.construct(p, std::forward<Args>(args)...) if possible.
// If not possible, calls
// ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)
template <typename T, typename... Args>
static void construct(Alloc& a, T* p, // NOLINT(runtime/references)
Args&&... args) {
construct_impl(0, a, p, std::forward<Args>(args)...);
}
// destroy(Alloc& a, T* p):
// Calls a.destroy(p) if possible. If not possible, calls p->~T().
template <typename T>
static void destroy(Alloc& a, T* p) { // NOLINT(runtime/references)
destroy_impl(0, a, p);
}
// max_size(const Alloc& a):
// Returns a.max_size() if possible. If not possible, returns
// std::numeric_limits<size_type>::max() / sizeof(value_type)
static size_type max_size(const Alloc& a) { return max_size_impl(0, a); }
// select_on_container_copy_construction(const Alloc& a):
// Returns a.select_on_container_copy_construction() if possible.
// If not possible, returns a.
static Alloc select_on_container_copy_construction(const Alloc& a) {
return select_on_container_copy_construction_impl(0, a);
}
private:
template <typename A>
static auto allocate_impl(int, A& a, // NOLINT(runtime/references)
size_type n, const_void_pointer hint)
-> decltype(a.allocate(n, hint)) {
return a.allocate(n, hint);
}
static pointer allocate_impl(char, Alloc& a, // NOLINT(runtime/references)
size_type n, const_void_pointer) {
return a.allocate(n);
}
template <typename A, typename... Args>
static auto construct_impl(int, A& a, // NOLINT(runtime/references)
Args&&... args)
-> decltype(a.construct(std::forward<Args>(args)...)) {
a.construct(std::forward<Args>(args)...);
}
template <typename T, typename... Args>
static void construct_impl(char, Alloc&, T* p, Args&&... args) {
::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
}
template <typename A, typename T>
static auto destroy_impl(int, A& a, // NOLINT(runtime/references)
T* p) -> decltype(a.destroy(p)) {
a.destroy(p);
}
template <typename T>
static void destroy_impl(char, Alloc&, T* p) {
p->~T();
}
template <typename A>
static auto max_size_impl(int, const A& a) -> decltype(a.max_size()) {
return a.max_size();
}
static size_type max_size_impl(char, const Alloc&) {
return (std::numeric_limits<size_type>::max)() / sizeof(value_type);
}
template <typename A>
static auto select_on_container_copy_construction_impl(int, const A& a)
-> decltype(a.select_on_container_copy_construction()) {
return a.select_on_container_copy_construction();
}
static Alloc select_on_container_copy_construction_impl(char,
const Alloc& a) {
return a;
}
};
namespace memory_internal {
// This template alias transforms Alloc::is_nothrow into a metafunction with
// Alloc as a parameter so it can be used with ExtractOrT<>.
template <typename Alloc>
using GetIsNothrow = typename Alloc::is_nothrow;
} // namespace memory_internal
// ABSL_ALLOCATOR_NOTHROW is a build time configuration macro for user to
// specify whether the default allocation function can throw or never throws.
// If the allocation function never throws, user should define it to a non-zero
// value (e.g. via `-DABSL_ALLOCATOR_NOTHROW`).
// If the allocation function can throw, user should leave it undefined or
// define it to zero.
//
// allocator_is_nothrow<Alloc> is a traits class that derives from
// Alloc::is_nothrow if present, otherwise std::false_type. It's specialized
// for Alloc = std::allocator<T> for any type T according to the state of
// ABSL_ALLOCATOR_NOTHROW.
//
// default_allocator_is_nothrow is a class that derives from std::true_type
// when the default allocator (global operator new) never throws, and
// std::false_type when it can throw. It is a convenience shorthand for writing
// allocator_is_nothrow<std::allocator<T>> (T can be any type).
// NOTE: allocator_is_nothrow<std::allocator<T>> is guaranteed to derive from
// the same type for all T, because users should specialize neither
// allocator_is_nothrow nor std::allocator.
template <typename Alloc>
struct allocator_is_nothrow
: memory_internal::ExtractOrT<memory_internal::GetIsNothrow, Alloc,
std::false_type> {};
#if ABSL_ALLOCATOR_NOTHROW
template <typename T>
struct allocator_is_nothrow<std::allocator<T>> : std::true_type {};
struct default_allocator_is_nothrow : std::true_type {};
#else
struct default_allocator_is_nothrow : std::false_type {};
#endif
namespace memory_internal {
template <typename Allocator, typename Iterator, typename... Args>
void ConstructRange(Allocator& alloc, Iterator first, Iterator last,
const Args&... args) {
for (Iterator cur = first; cur != last; ++cur) {
ABSL_INTERNAL_TRY {
std::allocator_traits<Allocator>::construct(alloc, std::addressof(*cur),
args...);
}
ABSL_INTERNAL_CATCH_ANY {
while (cur != first) {
--cur;
std::allocator_traits<Allocator>::destroy(alloc, std::addressof(*cur));
}
ABSL_INTERNAL_RETHROW;
}
}
}
template <typename Allocator, typename Iterator, typename InputIterator>
void CopyRange(Allocator& alloc, Iterator destination, InputIterator first,
InputIterator last) {
for (Iterator cur = destination; first != last;
static_cast<void>(++cur), static_cast<void>(++first)) {
ABSL_INTERNAL_TRY {
std::allocator_traits<Allocator>::construct(alloc, std::addressof(*cur),
*first);
}
ABSL_INTERNAL_CATCH_ANY {
while (cur != destination) {
--cur;
std::allocator_traits<Allocator>::destroy(alloc, std::addressof(*cur));
}
ABSL_INTERNAL_RETHROW;
}
}
}
} // namespace memory_internal
} // namespace absl
#endif // ABSL_MEMORY_MEMORY_H_

View File

@ -1,436 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// type_traits.h
// -----------------------------------------------------------------------------
//
// This file contains C++11-compatible versions of standard <type_traits> API
// functions for determining the characteristics of types. Such traits can
// support type inference, classification, and transformation, as well as
// make it easier to write templates based on generic type behavior.
//
// See http://en.cppreference.com/w/cpp/header/type_traits
//
// WARNING: use of many of the constructs in this header will count as "complex
// template metaprogramming", so before proceeding, please carefully consider
// https://google.github.io/styleguide/cppguide.html#Template_metaprogramming
//
// WARNING: using template metaprogramming to detect or depend on API
// features is brittle and not guaranteed. Neither the standard library nor
// Abseil provides any guarantee that APIs are stable in the face of template
// metaprogramming. Use with caution.
#ifndef ABSL_META_TYPE_TRAITS_H_
#define ABSL_META_TYPE_TRAITS_H_
#include <stddef.h>
#include <functional>
#include <type_traits>
#include "absl/base/config.h"
namespace absl {
namespace type_traits_internal {
template <typename... Ts>
struct VoidTImpl {
using type = void;
};
// This trick to retrieve a default alignment is necessary for our
// implementation of aligned_storage_t to be consistent with any implementation
// of std::aligned_storage.
template <size_t Len, typename T = std::aligned_storage<Len>>
struct default_alignment_of_aligned_storage;
template <size_t Len, size_t Align>
struct default_alignment_of_aligned_storage<Len,
std::aligned_storage<Len, Align>> {
static constexpr size_t value = Align;
};
////////////////////////////////
// Library Fundamentals V2 TS //
////////////////////////////////
// NOTE: The `is_detected` family of templates here differ from the library
// fundamentals specification in that for library fundamentals, `Op<Args...>` is
// evaluated as soon as the type `is_detected<Op, Args...>` undergoes
// substitution, regardless of whether or not the `::value` is accessed. That
// is inconsistent with all other standard traits and prevents lazy evaluation
// in larger contexts (such as if the `is_detected` check is a trailing argument
// of a `conjunction`. This implementation opts to instead be lazy in the same
// way that the standard traits are (this "defect" of the detection idiom
// specifications has been reported).
template <class Enabler, template <class...> class Op, class... Args>
struct is_detected_impl {
using type = std::false_type;
};
template <template <class...> class Op, class... Args>
struct is_detected_impl<typename VoidTImpl<Op<Args...>>::type, Op, Args...> {
using type = std::true_type;
};
template <template <class...> class Op, class... Args>
struct is_detected : is_detected_impl<void, Op, Args...>::type {};
template <class Enabler, class To, template <class...> class Op, class... Args>
struct is_detected_convertible_impl {
using type = std::false_type;
};
template <class To, template <class...> class Op, class... Args>
struct is_detected_convertible_impl<
typename std::enable_if<std::is_convertible<Op<Args...>, To>::value>::type,
To, Op, Args...> {
using type = std::true_type;
};
template <class To, template <class...> class Op, class... Args>
struct is_detected_convertible
: is_detected_convertible_impl<void, To, Op, Args...>::type {};
template <typename T>
using IsCopyAssignableImpl =
decltype(std::declval<T&>() = std::declval<const T&>());
template <typename T>
using IsMoveAssignableImpl = decltype(std::declval<T&>() = std::declval<T&&>());
} // namespace type_traits_internal
template <typename T>
struct is_copy_assignable : type_traits_internal::is_detected<
type_traits_internal::IsCopyAssignableImpl, T> {
};
template <typename T>
struct is_move_assignable : type_traits_internal::is_detected<
type_traits_internal::IsMoveAssignableImpl, T> {
};
// void_t()
//
// Ignores the type of any its arguments and returns `void`. In general, this
// metafunction allows you to create a general case that maps to `void` while
// allowing specializations that map to specific types.
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::void_t` metafunction.
//
// NOTE: `absl::void_t` does not use the standard-specified implementation so
// that it can remain compatible with gcc < 5.1. This can introduce slightly
// different behavior, such as when ordering partial specializations.
template <typename... Ts>
using void_t = typename type_traits_internal::VoidTImpl<Ts...>::type;
// conjunction
//
// Performs a compile-time logical AND operation on the passed types (which
// must have `::value` members convertible to `bool`. Short-circuits if it
// encounters any `false` members (and does not compare the `::value` members
// of any remaining arguments).
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::conjunction` metafunction.
template <typename... Ts>
struct conjunction;
template <typename T, typename... Ts>
struct conjunction<T, Ts...>
: std::conditional<T::value, conjunction<Ts...>, T>::type {};
template <typename T>
struct conjunction<T> : T {};
template <>
struct conjunction<> : std::true_type {};
// disjunction
//
// Performs a compile-time logical OR operation on the passed types (which
// must have `::value` members convertible to `bool`. Short-circuits if it
// encounters any `true` members (and does not compare the `::value` members
// of any remaining arguments).
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::disjunction` metafunction.
template <typename... Ts>
struct disjunction;
template <typename T, typename... Ts>
struct disjunction<T, Ts...> :
std::conditional<T::value, T, disjunction<Ts...>>::type {};
template <typename T>
struct disjunction<T> : T {};
template <>
struct disjunction<> : std::false_type {};
// negation
//
// Performs a compile-time logical NOT operation on the passed type (which
// must have `::value` members convertible to `bool`.
//
// This metafunction is designed to be a drop-in replacement for the C++17
// `std::negation` metafunction.
template <typename T>
struct negation : std::integral_constant<bool, !T::value> {};
// is_trivially_destructible()
//
// Determines whether the passed type `T` is trivially destructable.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_destructible()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: the extensions (__has_trivial_xxx) are implemented in gcc (version >=
// 4.3) and clang. Since we are supporting libstdc++ > 4.7, they should always
// be present. These extensions are documented at
// https://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html#Type-Traits.
template <typename T>
struct is_trivially_destructible
: std::integral_constant<bool, __has_trivial_destructor(T) &&
std::is_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
private:
static constexpr bool compliant = std::is_trivially_destructible<T>::value ==
is_trivially_destructible::value;
static_assert(compliant || std::is_trivially_destructible<T>::value,
"Not compliant with std::is_trivially_destructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_destructible<T>::value,
"Not compliant with std::is_trivially_destructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
};
// is_trivially_default_constructible()
//
// Determines whether the passed type `T` is trivially default constructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_default_constructible()` metafunction for platforms that
// have incomplete C++11 support (such as libstdc++ 4.x). On any platforms that
// do fully support C++11, we check whether this yields the same result as the
// std implementation.
//
// NOTE: according to the C++ standard, Section: 20.15.4.3 [meta.unary.prop]
// "The predicate condition for a template specialization is_constructible<T,
// Args...> shall be satisfied if and only if the following variable
// definition would be well-formed for some invented variable t:
//
// T t(declval<Args>()...);
//
// is_trivially_constructible<T, Args...> additionally requires that the
// variable definition does not call any operation that is not trivial.
// For the purposes of this check, the call to std::declval is considered
// trivial."
//
// Notes from http://en.cppreference.com/w/cpp/types/is_constructible:
// In many implementations, is_nothrow_constructible also checks if the
// destructor throws because it is effectively noexcept(T(arg)). Same
// applies to is_trivially_constructible, which, in these implementations, also
// requires that the destructor is trivial.
// GCC bug 51452: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51452
// LWG issue 2116: http://cplusplus.github.io/LWG/lwg-active.html#2116.
//
// "T obj();" need to be well-formed and not call any nontrivial operation.
// Nontrivially destructible types will cause the expression to be nontrivial.
template <typename T>
struct is_trivially_default_constructible
: std::integral_constant<bool, __has_trivial_constructor(T) &&
std::is_default_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
private:
static constexpr bool compliant =
std::is_trivially_default_constructible<T>::value ==
is_trivially_default_constructible::value;
static_assert(compliant || std::is_trivially_default_constructible<T>::value,
"Not compliant with std::is_trivially_default_constructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_default_constructible<T>::value,
"Not compliant with std::is_trivially_default_constructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
};
// is_trivially_copy_constructible()
//
// Determines whether the passed type `T` is trivially copy constructible.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_copy_constructible()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `T obj(declval<const T&>());` needs to be well-formed and not call any
// nontrivial operation. Nontrivially destructible types will cause the
// expression to be nontrivial.
template <typename T>
struct is_trivially_copy_constructible
: std::integral_constant<bool, __has_trivial_copy(T) &&
std::is_copy_constructible<T>::value &&
is_trivially_destructible<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
private:
static constexpr bool compliant =
std::is_trivially_copy_constructible<T>::value ==
is_trivially_copy_constructible::value;
static_assert(compliant || std::is_trivially_copy_constructible<T>::value,
"Not compliant with std::is_trivially_copy_constructible; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_copy_constructible<T>::value,
"Not compliant with std::is_trivially_copy_constructible; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_CONSTRUCTIBLE
};
// is_trivially_copy_assignable()
//
// Determines whether the passed type `T` is trivially copy assignable.
//
// This metafunction is designed to be a drop-in replacement for the C++11
// `std::is_trivially_copy_assignable()` metafunction for platforms that have
// incomplete C++11 support (such as libstdc++ 4.x). On any platforms that do
// fully support C++11, we check whether this yields the same result as the std
// implementation.
//
// NOTE: `is_assignable<T, U>::value` is `true` if the expression
// `declval<T>() = declval<U>()` is well-formed when treated as an unevaluated
// operand. `is_trivially_assignable<T, U>` requires the assignment to call no
// operation that is not trivial. `is_trivially_copy_assignable<T>` is simply
// `is_trivially_assignable<T&, const T&>`.
template <typename T>
struct is_trivially_copy_assignable
: std::integral_constant<
bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
absl::is_copy_assignable<T>::value> {
#ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
private:
static constexpr bool compliant =
std::is_trivially_copy_assignable<T>::value ==
is_trivially_copy_assignable::value;
static_assert(compliant || std::is_trivially_copy_assignable<T>::value,
"Not compliant with std::is_trivially_copy_assignable; "
"Standard: false, Implementation: true");
static_assert(compliant || !std::is_trivially_copy_assignable<T>::value,
"Not compliant with std::is_trivially_copy_assignable; "
"Standard: true, Implementation: false");
#endif // ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE
};
// -----------------------------------------------------------------------------
// C++14 "_t" trait aliases
// -----------------------------------------------------------------------------
template <typename T>
using remove_cv_t = typename std::remove_cv<T>::type;
template <typename T>
using remove_const_t = typename std::remove_const<T>::type;
template <typename T>
using remove_volatile_t = typename std::remove_volatile<T>::type;
template <typename T>
using add_cv_t = typename std::add_cv<T>::type;
template <typename T>
using add_const_t = typename std::add_const<T>::type;
template <typename T>
using add_volatile_t = typename std::add_volatile<T>::type;
template <typename T>
using remove_reference_t = typename std::remove_reference<T>::type;
template <typename T>
using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type;
template <typename T>
using add_rvalue_reference_t = typename std::add_rvalue_reference<T>::type;
template <typename T>
using remove_pointer_t = typename std::remove_pointer<T>::type;
template <typename T>
using add_pointer_t = typename std::add_pointer<T>::type;
template <typename T>
using make_signed_t = typename std::make_signed<T>::type;
template <typename T>
using make_unsigned_t = typename std::make_unsigned<T>::type;
template <typename T>
using remove_extent_t = typename std::remove_extent<T>::type;
template <typename T>
using remove_all_extents_t = typename std::remove_all_extents<T>::type;
template <size_t Len, size_t Align = type_traits_internal::
default_alignment_of_aligned_storage<Len>::value>
using aligned_storage_t = typename std::aligned_storage<Len, Align>::type;
template <typename T>
using decay_t = typename std::decay<T>::type;
template <bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
template <bool B, typename T, typename F>
using conditional_t = typename std::conditional<B, T, F>::type;
template <typename... T>
using common_type_t = typename std::common_type<T...>::type;
template <typename T>
using underlying_type_t = typename std::underlying_type<T>::type;
template <typename T>
using result_of_t = typename std::result_of<T>::type;
namespace type_traits_internal {
template <typename Key, typename = size_t>
struct IsHashable : std::false_type {};
template <typename Key>
struct IsHashable<Key,
decltype(std::declval<std::hash<Key>>()(std::declval<Key>()))>
: std::true_type {};
template <typename Key>
struct IsHashEnabled
: absl::conjunction<std::is_default_constructible<std::hash<Key>>,
std::is_copy_constructible<std::hash<Key>>,
std::is_destructible<std::hash<Key>>,
absl::is_copy_assignable<std::hash<Key>>,
IsHashable<Key>> {};
} // namespace type_traits_internal
} // namespace absl
#endif // ABSL_META_TYPE_TRAITS_H_

View File

@ -1,198 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/strings/ascii.h"
namespace absl {
namespace ascii_internal {
// # Table generated by this Python code (bit 0x02 is currently unused):
// TODO(mbar) Move Python code for generation of table to BUILD and link here.
// NOTE: The kAsciiPropertyBits table used within this code was generated by
// Python code of the following form. (Bit 0x02 is currently unused and
// available.)
//
// def Hex2(n):
// return '0x' + hex(n/16)[2:] + hex(n%16)[2:]
// def IsPunct(ch):
// return (ord(ch) >= 32 and ord(ch) < 127 and
// not ch.isspace() and not ch.isalnum())
// def IsBlank(ch):
// return ch in ' \t'
// def IsCntrl(ch):
// return ord(ch) < 32 or ord(ch) == 127
// def IsXDigit(ch):
// return ch.isdigit() or ch.lower() in 'abcdef'
// for i in range(128):
// ch = chr(i)
// mask = ((ch.isalpha() and 0x01 or 0) |
// (ch.isalnum() and 0x04 or 0) |
// (ch.isspace() and 0x08 or 0) |
// (IsPunct(ch) and 0x10 or 0) |
// (IsBlank(ch) and 0x20 or 0) |
// (IsCntrl(ch) and 0x40 or 0) |
// (IsXDigit(ch) and 0x80 or 0))
// print Hex2(mask) + ',',
// if i % 16 == 7:
// print ' //', Hex2(i & 0x78)
// elif i % 16 == 15:
// print
// clang-format off
// Array of bitfields holding character information. Each bit value corresponds
// to a particular character feature. For readability, and because the value
// of these bits is tightly coupled to this implementation, the individual bits
// are not named. Note that bitfields for all characters above ASCII 127 are
// zero-initialized.
const unsigned char kPropertyBits[256] = {
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // 0x00
0x40, 0x68, 0x48, 0x48, 0x48, 0x48, 0x40, 0x40,
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // 0x10
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 0x20
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, // 0x30
0x84, 0x84, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x05, // 0x40
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, // 0x50
0x05, 0x05, 0x05, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x05, // 0x60
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, // 0x70
0x05, 0x05, 0x05, 0x10, 0x10, 0x10, 0x10, 0x40,
};
// Array of characters for the ascii_tolower() function. For values 'A'
// through 'Z', return the lower-case character; otherwise, return the
// identity of the passed character.
const char kToLower[256] = {
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
'\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
'\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
'\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
'\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
'\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
'\x40', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f',
'\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67',
'\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f',
'\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77',
'\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f',
'\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87',
'\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f',
'\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97',
'\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f',
'\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7',
'\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf',
'\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7',
'\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf',
'\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7',
'\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf',
'\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7',
'\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf',
'\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7',
'\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef',
'\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7',
'\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff',
};
// Array of characters for the ascii_toupper() function. For values 'a'
// through 'z', return the upper-case character; otherwise, return the
// identity of the passed character.
const char kToUpper[256] = {
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
'\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
'\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
'\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
'\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
'\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
'\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
'\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
'\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47',
'\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f',
'\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57',
'\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f',
'\x60', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f',
'\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87',
'\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f',
'\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97',
'\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f',
'\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7',
'\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf',
'\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7',
'\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf',
'\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7',
'\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf',
'\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7',
'\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf',
'\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7',
'\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef',
'\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7',
'\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff',
};
// clang-format on
} // namespace ascii_internal
void AsciiStrToLower(std::string* s) {
for (auto& ch : *s) {
ch = absl::ascii_tolower(ch);
}
}
void AsciiStrToUpper(std::string* s) {
for (auto& ch : *s) {
ch = absl::ascii_toupper(ch);
}
}
void RemoveExtraAsciiWhitespace(std::string* str) {
auto stripped = StripAsciiWhitespace(*str);
if (stripped.empty()) {
str->clear();
return;
}
auto input_it = stripped.begin();
auto input_end = stripped.end();
auto output_it = &(*str)[0];
bool is_ws = false;
for (; input_it < input_end; ++input_it) {
if (is_ws) {
// Consecutive whitespace? Keep only the last.
is_ws = absl::ascii_isspace(*input_it);
if (is_ws) --output_it;
} else {
is_ws = absl::ascii_isspace(*input_it);
}
*output_it = *input_it;
++output_it;
}
str->erase(output_it - &(*str)[0]);
}
} // namespace absl

View File

@ -1,239 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: ascii.h
// -----------------------------------------------------------------------------
//
// This package contains functions operating on characters and strings
// restricted to standard ASCII. These include character classification
// functions analogous to those found in the ANSI C Standard Library <ctype.h>
// header file.
//
// C++ implementations provide <ctype.h> functionality based on their
// C environment locale. In general, reliance on such a locale is not ideal, as
// the locale standard is problematic (and may not return invariant information
// for the same character set, for example). These `ascii_*()` functions are
// hard-wired for standard ASCII, much faster, and guaranteed to behave
// consistently. They will never be overloaded, nor will their function
// signature change.
//
// `ascii_isalnum()`, `ascii_isalpha()`, `ascii_isascii()`, `ascii_isblank()`,
// `ascii_iscntrl()`, `ascii_isdigit()`, `ascii_isgraph()`, `ascii_islower()`,
// `ascii_isprint()`, `ascii_ispunct()`, `ascii_isspace()`, `ascii_isupper()`,
// `ascii_isxdigit()`
// Analogous to the <ctype.h> functions with similar names, these
// functions take an unsigned char and return a bool, based on whether the
// character matches the condition specified.
//
// If the input character has a numerical value greater than 127, these
// functions return `false`.
//
// `ascii_tolower()`, `ascii_toupper()`
// Analogous to the <ctype.h> functions with similar names, these functions
// take an unsigned char and return a char.
//
// If the input character is not an ASCII {lower,upper}-case letter (including
// numerical values greater than 127) then the functions return the same value
// as the input character.
#ifndef ABSL_STRINGS_ASCII_H_
#define ABSL_STRINGS_ASCII_H_
#include <algorithm>
#include <string>
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
namespace absl {
namespace ascii_internal {
// Declaration for an array of bitfields holding character information.
extern const unsigned char kPropertyBits[256];
// Declaration for the array of characters to upper-case characters.
extern const char kToUpper[256];
// Declaration for the array of characters to lower-case characters.
extern const char kToLower[256];
} // namespace ascii_internal
// ascii_isalpha()
//
// Determines whether the given character is an alphabetic character.
inline bool ascii_isalpha(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x01) != 0;
}
// ascii_isalnum()
//
// Determines whether the given character is an alphanumeric character.
inline bool ascii_isalnum(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x04) != 0;
}
// ascii_isspace()
//
// Determines whether the given character is a whitespace character (space,
// tab, vertical tab, formfeed, linefeed, or carriage return).
inline bool ascii_isspace(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x08) != 0;
}
// ascii_ispunct()
//
// Determines whether the given character is a punctuation character.
inline bool ascii_ispunct(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x10) != 0;
}
// ascii_isblank()
//
// Determines whether the given character is a blank character (tab or space).
inline bool ascii_isblank(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x20) != 0;
}
// ascii_iscntrl()
//
// Determines whether the given character is a control character.
inline bool ascii_iscntrl(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x40) != 0;
}
// ascii_isxdigit()
//
// Determines whether the given character can be represented as a hexadecimal
// digit character (i.e. {0-9} or {A-F}).
inline bool ascii_isxdigit(unsigned char c) {
return (ascii_internal::kPropertyBits[c] & 0x80) != 0;
}
// ascii_isdigit()
//
// Determines whether the given character can be represented as a decimal
// digit character (i.e. {0-9}).
inline bool ascii_isdigit(unsigned char c) { return c >= '0' && c <= '9'; }
// ascii_isprint()
//
// Determines whether the given character is printable, including whitespace.
inline bool ascii_isprint(unsigned char c) { return c >= 32 && c < 127; }
// ascii_isgraph()
//
// Determines whether the given character has a graphical representation.
inline bool ascii_isgraph(unsigned char c) { return c > 32 && c < 127; }
// ascii_isupper()
//
// Determines whether the given character is uppercase.
inline bool ascii_isupper(unsigned char c) { return c >= 'A' && c <= 'Z'; }
// ascii_islower()
//
// Determines whether the given character is lowercase.
inline bool ascii_islower(unsigned char c) { return c >= 'a' && c <= 'z'; }
// ascii_isascii()
//
// Determines whether the given character is ASCII.
inline bool ascii_isascii(unsigned char c) { return c < 128; }
// ascii_tolower()
//
// Returns an ASCII character, converting to lowercase if uppercase is
// passed. Note that character values > 127 are simply returned.
inline char ascii_tolower(unsigned char c) {
return ascii_internal::kToLower[c];
}
// Converts the characters in `s` to lowercase, changing the contents of `s`.
void AsciiStrToLower(std::string* s);
// Creates a lowercase string from a given absl::string_view.
ABSL_MUST_USE_RESULT inline std::string AsciiStrToLower(absl::string_view s) {
std::string result(s);
absl::AsciiStrToLower(&result);
return result;
}
// ascii_toupper()
//
// Returns the ASCII character, converting to upper-case if lower-case is
// passed. Note that characters values > 127 are simply returned.
inline char ascii_toupper(unsigned char c) {
return ascii_internal::kToUpper[c];
}
// Converts the characters in `s` to uppercase, changing the contents of `s`.
void AsciiStrToUpper(std::string* s);
// Creates an uppercase string from a given absl::string_view.
ABSL_MUST_USE_RESULT inline std::string AsciiStrToUpper(absl::string_view s) {
std::string result(s);
absl::AsciiStrToUpper(&result);
return result;
}
// Returns absl::string_view with whitespace stripped from the beginning of the
// given string_view.
ABSL_MUST_USE_RESULT inline absl::string_view StripLeadingAsciiWhitespace(
absl::string_view str) {
auto it = std::find_if_not(str.begin(), str.end(), absl::ascii_isspace);
return str.substr(it - str.begin());
}
// Strips in place whitespace from the beginning of the given string.
inline void StripLeadingAsciiWhitespace(std::string* str) {
auto it = std::find_if_not(str->begin(), str->end(), absl::ascii_isspace);
str->erase(str->begin(), it);
}
// Returns absl::string_view with whitespace stripped from the end of the given
// string_view.
ABSL_MUST_USE_RESULT inline absl::string_view StripTrailingAsciiWhitespace(
absl::string_view str) {
auto it = std::find_if_not(str.rbegin(), str.rend(), absl::ascii_isspace);
return str.substr(0, str.rend() - it);
}
// Strips in place whitespace from the end of the given string
inline void StripTrailingAsciiWhitespace(std::string* str) {
auto it = std::find_if_not(str->rbegin(), str->rend(), absl::ascii_isspace);
str->erase(str->rend() - it);
}
// Returns absl::string_view with whitespace stripped from both ends of the
// given string_view.
ABSL_MUST_USE_RESULT inline absl::string_view StripAsciiWhitespace(
absl::string_view str) {
return StripTrailingAsciiWhitespace(StripLeadingAsciiWhitespace(str));
}
// Strips in place whitespace from both ends of the given string
inline void StripAsciiWhitespace(std::string* str) {
StripTrailingAsciiWhitespace(str);
StripLeadingAsciiWhitespace(str);
}
// Removes leading, trailing, and consecutive internal whitespace.
void RemoveExtraAsciiWhitespace(std::string*);
} // namespace absl
#endif // ABSL_STRINGS_ASCII_H_

View File

@ -1,110 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/strings/internal/memutil.h"
#include <cstdlib>
namespace absl {
namespace strings_internal {
int memcasecmp(const char* s1, const char* s2, size_t len) {
const unsigned char* us1 = reinterpret_cast<const unsigned char*>(s1);
const unsigned char* us2 = reinterpret_cast<const unsigned char*>(s2);
for (size_t i = 0; i < len; i++) {
const int diff =
int{static_cast<unsigned char>(absl::ascii_tolower(us1[i]))} -
int{static_cast<unsigned char>(absl::ascii_tolower(us2[i]))};
if (diff != 0) return diff;
}
return 0;
}
char* memdup(const char* s, size_t slen) {
void* copy;
if ((copy = malloc(slen)) == nullptr) return nullptr;
memcpy(copy, s, slen);
return reinterpret_cast<char*>(copy);
}
char* memrchr(const char* s, int c, size_t slen) {
for (const char* e = s + slen - 1; e >= s; e--) {
if (*e == c) return const_cast<char*>(e);
}
return nullptr;
}
size_t memspn(const char* s, size_t slen, const char* accept) {
const char* p = s;
const char* spanp;
char c, sc;
cont:
c = *p++;
if (slen-- == 0) return p - 1 - s;
for (spanp = accept; (sc = *spanp++) != '\0';)
if (sc == c) goto cont;
return p - 1 - s;
}
size_t memcspn(const char* s, size_t slen, const char* reject) {
const char* p = s;
const char* spanp;
char c, sc;
while (slen-- != 0) {
c = *p++;
for (spanp = reject; (sc = *spanp++) != '\0';)
if (sc == c) return p - 1 - s;
}
return p - s;
}
char* mempbrk(const char* s, size_t slen, const char* accept) {
const char* scanp;
int sc;
for (; slen; ++s, --slen) {
for (scanp = accept; (sc = *scanp++) != '\0';)
if (sc == *s) return const_cast<char*>(s);
}
return nullptr;
}
// This is significantly faster for case-sensitive matches with very
// few possible matches. See unit test for benchmarks.
const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
size_t neelen) {
if (0 == neelen) {
return phaystack; // even if haylen is 0
}
if (haylen < neelen) return nullptr;
const char* match;
const char* hayend = phaystack + haylen - neelen + 1;
// A static cast is used here to work around the fact that memchr returns
// a void* on Posix-compliant systems and const void* on Windows.
while ((match = static_cast<const char*>(
memchr(phaystack, pneedle[0], hayend - phaystack)))) {
if (memcmp(match, pneedle, neelen) == 0)
return match;
else
phaystack = match + 1;
}
return nullptr;
}
} // namespace strings_internal
} // namespace absl

View File

@ -1,146 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// These routines provide mem versions of standard C string routines,
// such as strpbrk. They function exactly the same as the str versions,
// so if you wonder what they are, replace the word "mem" by
// "str" and check out the man page. I could return void*, as the
// strutil.h mem*() routines tend to do, but I return char* instead
// since this is by far the most common way these functions are called.
//
// The difference between the mem and str versions is the mem version
// takes a pointer and a length, rather than a '\0'-terminated string.
// The memcase* routines defined here assume the locale is "C"
// (they use absl::ascii_tolower instead of tolower).
//
// These routines are based on the BSD library.
//
// Here's a list of routines from string.h, and their mem analogues.
// Functions in lowercase are defined in string.h; those in UPPERCASE
// are defined here:
//
// strlen --
// strcat strncat MEMCAT
// strcpy strncpy memcpy
// -- memccpy (very cool function, btw)
// -- memmove
// -- memset
// strcmp strncmp memcmp
// strcasecmp strncasecmp MEMCASECMP
// strchr memchr
// strcoll --
// strxfrm --
// strdup strndup MEMDUP
// strrchr MEMRCHR
// strspn MEMSPN
// strcspn MEMCSPN
// strpbrk MEMPBRK
// strstr MEMSTR MEMMEM
// (g)strcasestr MEMCASESTR MEMCASEMEM
// strtok --
// strprefix MEMPREFIX (strprefix is from strutil.h)
// strcaseprefix MEMCASEPREFIX (strcaseprefix is from strutil.h)
// strsuffix MEMSUFFIX (strsuffix is from strutil.h)
// strcasesuffix MEMCASESUFFIX (strcasesuffix is from strutil.h)
// -- MEMIS
// -- MEMCASEIS
// strcount MEMCOUNT (strcount is from strutil.h)
#ifndef ABSL_STRINGS_INTERNAL_MEMUTIL_H_
#define ABSL_STRINGS_INTERNAL_MEMUTIL_H_
#include <cstddef>
#include <cstring>
#include "absl/base/port.h" // disable some warnings on Windows
#include "absl/strings/ascii.h" // for absl::ascii_tolower
namespace absl {
namespace strings_internal {
inline char* memcat(char* dest, size_t destlen, const char* src,
size_t srclen) {
return reinterpret_cast<char*>(memcpy(dest + destlen, src, srclen));
}
int memcasecmp(const char* s1, const char* s2, size_t len);
char* memdup(const char* s, size_t slen);
char* memrchr(const char* s, int c, size_t slen);
size_t memspn(const char* s, size_t slen, const char* accept);
size_t memcspn(const char* s, size_t slen, const char* reject);
char* mempbrk(const char* s, size_t slen, const char* accept);
// This is for internal use only. Don't call this directly
template <bool case_sensitive>
const char* int_memmatch(const char* haystack, size_t haylen,
const char* needle, size_t neelen) {
if (0 == neelen) {
return haystack; // even if haylen is 0
}
const char* hayend = haystack + haylen;
const char* needlestart = needle;
const char* needleend = needlestart + neelen;
for (; haystack < hayend; ++haystack) {
char hay = case_sensitive
? *haystack
: absl::ascii_tolower(static_cast<unsigned char>(*haystack));
char nee = case_sensitive
? *needle
: absl::ascii_tolower(static_cast<unsigned char>(*needle));
if (hay == nee) {
if (++needle == needleend) {
return haystack + 1 - neelen;
}
} else if (needle != needlestart) {
// must back up haystack in case a prefix matched (find "aab" in "aaab")
haystack -= needle - needlestart; // for loop will advance one more
needle = needlestart;
}
}
return nullptr;
}
// These are the guys you can call directly
inline const char* memstr(const char* phaystack, size_t haylen,
const char* pneedle) {
return int_memmatch<true>(phaystack, haylen, pneedle, strlen(pneedle));
}
inline const char* memcasestr(const char* phaystack, size_t haylen,
const char* pneedle) {
return int_memmatch<false>(phaystack, haylen, pneedle, strlen(pneedle));
}
inline const char* memmem(const char* phaystack, size_t haylen,
const char* pneedle, size_t needlelen) {
return int_memmatch<true>(phaystack, haylen, pneedle, needlelen);
}
inline const char* memcasemem(const char* phaystack, size_t haylen,
const char* pneedle, size_t needlelen) {
return int_memmatch<false>(phaystack, haylen, pneedle, needlelen);
}
// This is significantly faster for case-sensitive matches with very
// few possible matches. See unit test for benchmarks.
const char* memmatch(const char* phaystack, size_t haylen, const char* pneedle,
size_t neelen);
} // namespace strings_internal
} // namespace absl
#endif // ABSL_STRINGS_INTERNAL_MEMUTIL_H_

View File

@ -1,245 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/strings/string_view.h"
#ifndef ABSL_HAVE_STD_STRING_VIEW
#include <algorithm>
#include <climits>
#include <cstring>
#include <ostream>
#include "absl/strings/internal/memutil.h"
namespace absl {
namespace {
void WritePadding(std::ostream& o, size_t pad) {
char fill_buf[32];
memset(fill_buf, o.fill(), sizeof(fill_buf));
while (pad) {
size_t n = std::min(pad, sizeof(fill_buf));
o.write(fill_buf, n);
pad -= n;
}
}
class LookupTable {
public:
// For each character in wanted, sets the index corresponding
// to the ASCII code of that character. This is used by
// the find_.*_of methods below to tell whether or not a character is in
// the lookup table in constant time.
explicit LookupTable(string_view wanted) {
for (char c : wanted) {
table_[Index(c)] = true;
}
}
bool operator[](char c) const { return table_[Index(c)]; }
private:
static unsigned char Index(char c) { return static_cast<unsigned char>(c); }
bool table_[UCHAR_MAX + 1] = {};
};
} // namespace
std::ostream& operator<<(std::ostream& o, string_view piece) {
std::ostream::sentry sentry(o);
if (sentry) {
size_t lpad = 0;
size_t rpad = 0;
if (static_cast<size_t>(o.width()) > piece.size()) {
size_t pad = o.width() - piece.size();
if ((o.flags() & o.adjustfield) == o.left) {
rpad = pad;
} else {
lpad = pad;
}
}
if (lpad) WritePadding(o, lpad);
o.write(piece.data(), piece.size());
if (rpad) WritePadding(o, rpad);
o.width(0);
}
return o;
}
string_view::size_type string_view::copy(char* buf, size_type n,
size_type pos) const {
size_type ulen = length_;
assert(pos <= ulen);
size_type rlen = std::min(ulen - pos, n);
if (rlen > 0) {
const char* start = ptr_ + pos;
std::copy(start, start + rlen, buf);
}
return rlen;
}
string_view::size_type string_view::find(string_view s, size_type pos) const
noexcept {
if (empty() || pos > length_) {
if (empty() && pos == 0 && s.empty()) return 0;
return npos;
}
const char* result =
strings_internal::memmatch(ptr_ + pos, length_ - pos, s.ptr_, s.length_);
return result ? result - ptr_ : npos;
}
string_view::size_type string_view::find(char c, size_type pos) const noexcept {
if (empty() || pos >= length_) {
return npos;
}
const char* result =
static_cast<const char*>(memchr(ptr_ + pos, c, length_ - pos));
return result != nullptr ? result - ptr_ : npos;
}
string_view::size_type string_view::rfind(string_view s, size_type pos) const
noexcept {
if (length_ < s.length_) return npos;
if (s.empty()) return std::min(length_, pos);
const char* last = ptr_ + std::min(length_ - s.length_, pos) + s.length_;
const char* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_);
return result != last ? result - ptr_ : npos;
}
// Search range is [0..pos] inclusive. If pos == npos, search everything.
string_view::size_type string_view::rfind(char c, size_type pos) const
noexcept {
// Note: memrchr() is not available on Windows.
if (empty()) return npos;
for (size_type i = std::min(pos, length_ - 1);; --i) {
if (ptr_[i] == c) {
return i;
}
if (i == 0) break;
}
return npos;
}
string_view::size_type string_view::find_first_of(string_view s,
size_type pos) const
noexcept {
if (empty() || s.empty()) {
return npos;
}
// Avoid the cost of LookupTable() for a single-character search.
if (s.length_ == 1) return find_first_of(s.ptr_[0], pos);
LookupTable tbl(s);
for (size_type i = pos; i < length_; ++i) {
if (tbl[ptr_[i]]) {
return i;
}
}
return npos;
}
string_view::size_type string_view::find_first_not_of(string_view s,
size_type pos) const
noexcept {
if (empty()) return npos;
// Avoid the cost of LookupTable() for a single-character search.
if (s.length_ == 1) return find_first_not_of(s.ptr_[0], pos);
LookupTable tbl(s);
for (size_type i = pos; i < length_; ++i) {
if (!tbl[ptr_[i]]) {
return i;
}
}
return npos;
}
string_view::size_type string_view::find_first_not_of(char c,
size_type pos) const
noexcept {
if (empty()) return npos;
for (; pos < length_; ++pos) {
if (ptr_[pos] != c) {
return pos;
}
}
return npos;
}
string_view::size_type string_view::find_last_of(string_view s,
size_type pos) const noexcept {
if (empty() || s.empty()) return npos;
// Avoid the cost of LookupTable() for a single-character search.
if (s.length_ == 1) return find_last_of(s.ptr_[0], pos);
LookupTable tbl(s);
for (size_type i = std::min(pos, length_ - 1);; --i) {
if (tbl[ptr_[i]]) {
return i;
}
if (i == 0) break;
}
return npos;
}
string_view::size_type string_view::find_last_not_of(string_view s,
size_type pos) const
noexcept {
if (empty()) return npos;
size_type i = std::min(pos, length_ - 1);
if (s.empty()) return i;
// Avoid the cost of LookupTable() for a single-character search.
if (s.length_ == 1) return find_last_not_of(s.ptr_[0], pos);
LookupTable tbl(s);
for (;; --i) {
if (!tbl[ptr_[i]]) {
return i;
}
if (i == 0) break;
}
return npos;
}
string_view::size_type string_view::find_last_not_of(char c,
size_type pos) const
noexcept {
if (empty()) return npos;
size_type i = std::min(pos, length_ - 1);
for (;; --i) {
if (ptr_[i] != c) {
return i;
}
if (i == 0) break;
}
return npos;
}
// MSVC has non-standard behavior that implicitly creates definitions for static
// const members. These implicit definitions conflict with explicit out-of-class
// member definitions that are required by the C++ standard, resulting in
// LNK1169 "multiply defined" errors at link time. __declspec(selectany) asks
// MSVC to choose only one definition for the symbol it decorates. See details
// at http://msdn.microsoft.com/en-us/library/34h23df8(v=vs.100).aspx
#ifdef _MSC_VER
#define ABSL_STRING_VIEW_SELECTANY __declspec(selectany)
#else
#define ABSL_STRING_VIEW_SELECTANY
#endif
ABSL_STRING_VIEW_SELECTANY
constexpr string_view::size_type string_view::npos;
ABSL_STRING_VIEW_SELECTANY
constexpr string_view::size_type string_view::kMaxSize;
} // namespace absl
#endif // ABSL_HAVE_STD_STRING_VIEW

View File

@ -1,565 +0,0 @@
//
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// File: string_view.h
// -----------------------------------------------------------------------------
//
// This file contains the definition of the `absl::string_view` class. A
// `string_view` points to a contiguous span of characters, often part or all of
// another `std::string`, double-quoted string literal, character array, or even
// another `string_view`.
//
// This `absl::string_view` abstraction is designed to be a drop-in
// replacement for the C++17 `std::string_view` abstraction.
#ifndef ABSL_STRINGS_STRING_VIEW_H_
#define ABSL_STRINGS_STRING_VIEW_H_
#include <algorithm>
#include "absl/base/config.h"
#ifdef ABSL_HAVE_STD_STRING_VIEW
#include <string_view>
namespace absl {
using std::string_view;
} // namespace absl
#else // ABSL_HAVE_STD_STRING_VIEW
#include <cassert>
#include <cstddef>
#include <cstring>
#include <iosfwd>
#include <iterator>
#include <limits>
#include <string>
#include "absl/base/internal/throw_delegate.h"
#include "absl/base/macros.h"
#include "absl/base/port.h"
namespace absl {
// absl::string_view
//
// A `string_view` provides a lightweight view into the string data provided by
// a `std::string`, double-quoted string literal, character array, or even
// another `string_view`. A `string_view` does *not* own the string to which it
// points, and that data cannot be modified through the view.
//
// You can use `string_view` as a function or method parameter anywhere a
// parameter can receive a double-quoted string literal, `const char*`,
// `std::string`, or another `absl::string_view` argument with no need to copy
// the string data. Systematic use of `string_view` within function arguments
// reduces data copies and `strlen()` calls.
//
// Because of its small size, prefer passing `string_view` by value:
//
// void MyFunction(absl::string_view arg);
//
// If circumstances require, you may also pass one by const reference:
//
// void MyFunction(const absl::string_view& arg); // not preferred
//
// Passing by value generates slightly smaller code for many architectures.
//
// In either case, the source data of the `string_view` must outlive the
// `string_view` itself.
//
// A `string_view` is also suitable for local variables if you know that the
// lifetime of the underlying object is longer than the lifetime of your
// `string_view` variable. However, beware of binding a `string_view` to a
// temporary value:
//
// // BAD use of string_view: lifetime problem
// absl::string_view sv = obj.ReturnAString();
//
// // GOOD use of string_view: str outlives sv
// std::string str = obj.ReturnAString();
// absl::string_view sv = str;
//
// Due to lifetime issues, a `string_view` is sometimes a poor choice for a
// return value and usually a poor choice for a data member. If you do use a
// `string_view` this way, it is your responsibility to ensure that the object
// pointed to by the `string_view` outlives the `string_view`.
//
// A `string_view` may represent a whole string or just part of a string. For
// example, when splitting a string, `std::vector<absl::string_view>` is a
// natural data type for the output.
//
//
// When constructed from a source which is nul-terminated, the `string_view`
// itself will not include the nul-terminator unless a specific size (including
// the nul) is passed to the constructor. As a result, common idioms that work
// on nul-terminated strings do not work on `string_view` objects. If you write
// code that scans a `string_view`, you must check its length rather than test
// for nul, for example. Note, however, that nuls may still be embedded within
// a `string_view` explicitly.
//
// You may create a null `string_view` in two ways:
//
// absl::string_view sv();
// absl::string_view sv(nullptr, 0);
//
// For the above, `sv.data() == nullptr`, `sv.length() == 0`, and
// `sv.empty() == true`. Also, if you create a `string_view` with a non-null
// pointer then `sv.data() != nullptr`. Thus, you can use `string_view()` to
// signal an undefined value that is different from other `string_view` values
// in a similar fashion to how `const char* p1 = nullptr;` is different from
// `const char* p2 = "";`. However, in practice, it is not recommended to rely
// on this behavior.
//
// Be careful not to confuse a null `string_view` with an empty one. A null
// `string_view` is an empty `string_view`, but some empty `string_view`s are
// not null. Prefer checking for emptiness over checking for null.
//
// There are many ways to create an empty string_view:
//
// const char* nullcp = nullptr;
// // string_view.size() will return 0 in all cases.
// absl::string_view();
// absl::string_view(nullcp, 0);
// absl::string_view("");
// absl::string_view("", 0);
// absl::string_view("abcdef", 0);
// absl::string_view("abcdef" + 6, 0);
//
// All empty `string_view` objects whether null or not, are equal:
//
// absl::string_view() == absl::string_view("", 0)
// absl::string_view(nullptr, 0) == absl::string_view("abcdef"+6, 0)
class string_view {
public:
using traits_type = std::char_traits<char>;
using value_type = char;
using pointer = char*;
using const_pointer = const char*;
using reference = char&;
using const_reference = const char&;
using const_iterator = const char*;
using iterator = const_iterator;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using reverse_iterator = const_reverse_iterator;
using size_type = size_t;
using difference_type = std::ptrdiff_t;
static constexpr size_type npos = static_cast<size_type>(-1);
// Null `string_view` constructor
constexpr string_view() noexcept : ptr_(nullptr), length_(0) {}
// Implicit constructors
template <typename Allocator>
string_view( // NOLINT(runtime/explicit)
const std::basic_string<char, std::char_traits<char>, Allocator>&
str) noexcept
: ptr_(str.data()), length_(CheckLengthInternal(str.size())) {}
// Implicit constructor of a `string_view` from nul-terminated `str`. When
// accepting possibly null strings, use `absl::NullSafeStringView(str)`
// instead (see below).
#if ABSL_HAVE_BUILTIN(__builtin_strlen) || \
(defined(__GNUC__) && !defined(__clang__))
// GCC has __builtin_strlen according to
// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Other-Builtins.html, but
// ABSL_HAVE_BUILTIN doesn't detect that, so we use the extra checks above.
// __builtin_strlen is constexpr.
constexpr string_view(const char* str) // NOLINT(runtime/explicit)
: ptr_(str),
length_(CheckLengthInternal(str ? __builtin_strlen(str) : 0)) {}
#else
constexpr string_view(const char* str) // NOLINT(runtime/explicit)
: ptr_(str), length_(CheckLengthInternal(str ? strlen(str) : 0)) {}
#endif
// Implicit constructor of a `string_view` from a `const char*` and length.
constexpr string_view(const char* data, size_type len)
: ptr_(data), length_(CheckLengthInternal(len)) {}
// NOTE: Harmlessly omitted to work around gdb bug.
// constexpr string_view(const string_view&) noexcept = default;
// string_view& operator=(const string_view&) noexcept = default;
// Iterators
// string_view::begin()
//
// Returns an iterator pointing to the first character at the beginning of the
// `string_view`, or `end()` if the `string_view` is empty.
constexpr const_iterator begin() const noexcept { return ptr_; }
// string_view::end()
//
// Returns an iterator pointing just beyond the last character at the end of
// the `string_view`. This iterator acts as a placeholder; attempting to
// access it results in undefined behavior.
constexpr const_iterator end() const noexcept { return ptr_ + length_; }
// string_view::cbegin()
//
// Returns a const iterator pointing to the first character at the beginning
// of the `string_view`, or `end()` if the `string_view` is empty.
constexpr const_iterator cbegin() const noexcept { return begin(); }
// string_view::cend()
//
// Returns a const iterator pointing just beyond the last character at the end
// of the `string_view`. This pointer acts as a placeholder; attempting to
// access its element results in undefined behavior.
constexpr const_iterator cend() const noexcept { return end(); }
// string_view::rbegin()
//
// Returns a reverse iterator pointing to the last character at the end of the
// `string_view`, or `rend()` if the `string_view` is empty.
const_reverse_iterator rbegin() const noexcept {
return const_reverse_iterator(end());
}
// string_view::rend()
//
// Returns a reverse iterator pointing just before the first character at the
// beginning of the `string_view`. This pointer acts as a placeholder;
// attempting to access its element results in undefined behavior.
const_reverse_iterator rend() const noexcept {
return const_reverse_iterator(begin());
}
// string_view::crbegin()
//
// Returns a const reverse iterator pointing to the last character at the end
// of the `string_view`, or `crend()` if the `string_view` is empty.
const_reverse_iterator crbegin() const noexcept { return rbegin(); }
// string_view::crend()
//
// Returns a const reverse iterator pointing just before the first character
// at the beginning of the `string_view`. This pointer acts as a placeholder;
// attempting to access its element results in undefined behavior.
const_reverse_iterator crend() const noexcept { return rend(); }
// Capacity Utilities
// string_view::size()
//
// Returns the number of characters in the `string_view`.
constexpr size_type size() const noexcept {
return length_;
}
// string_view::length()
//
// Returns the number of characters in the `string_view`. Alias for `size()`.
constexpr size_type length() const noexcept { return size(); }
// string_view::max_size()
//
// Returns the maximum number of characters the `string_view` can hold.
constexpr size_type max_size() const noexcept { return kMaxSize; }
// string_view::empty()
//
// Checks if the `string_view` is empty (refers to no characters).
constexpr bool empty() const noexcept { return length_ == 0; }
// std::string:view::operator[]
//
// Returns the ith element of an `string_view` using the array operator.
// Note that this operator does not perform any bounds checking.
constexpr const_reference operator[](size_type i) const { return ptr_[i]; }
// string_view::front()
//
// Returns the first element of a `string_view`.
constexpr const_reference front() const { return ptr_[0]; }
// string_view::back()
//
// Returns the last element of a `string_view`.
constexpr const_reference back() const { return ptr_[size() - 1]; }
// string_view::data()
//
// Returns a pointer to the underlying character array (which is of course
// stored elsewhere). Note that `string_view::data()` may contain embedded nul
// characters, but the returned buffer may or may not be nul-terminated;
// therefore, do not pass `data()` to a routine that expects a nul-terminated
// std::string.
constexpr const_pointer data() const noexcept { return ptr_; }
// Modifiers
// string_view::remove_prefix()
//
// Removes the first `n` characters from the `string_view`. Note that the
// underlying std::string is not changed, only the view.
void remove_prefix(size_type n) {
assert(n <= length_);
ptr_ += n;
length_ -= n;
}
// string_view::remove_suffix()
//
// Removes the last `n` characters from the `string_view`. Note that the
// underlying std::string is not changed, only the view.
void remove_suffix(size_type n) {
assert(n <= length_);
length_ -= n;
}
// string_view::swap()
//
// Swaps this `string_view` with another `string_view`.
void swap(string_view& s) noexcept {
auto t = *this;
*this = s;
s = t;
}
// Explicit conversion operators
// Converts to `std::basic_string`.
template <typename A>
explicit operator std::basic_string<char, traits_type, A>() const {
if (!data()) return {};
return std::basic_string<char, traits_type, A>(data(), size());
}
// string_view::copy()
//
// Copies the contents of the `string_view` at offset `pos` and length `n`
// into `buf`.
size_type copy(char* buf, size_type n, size_type pos = 0) const;
// string_view::substr()
//
// Returns a "substring" of the `string_view` (at offset `pos` and length
// `n`) as another string_view. This function throws `std::out_of_bounds` if
// `pos > size`.
string_view substr(size_type pos, size_type n = npos) const {
if (ABSL_PREDICT_FALSE(pos > length_))
base_internal::ThrowStdOutOfRange("absl::string_view::substr");
n = std::min(n, length_ - pos);
return string_view(ptr_ + pos, n);
}
// string_view::compare()
//
// Performs a lexicographical comparison between the `string_view` and
// another `absl::string_view`, returning -1 if `this` is less than, 0 if
// `this` is equal to, and 1 if `this` is greater than the passed std::string
// view. Note that in the case of data equality, a further comparison is made
// on the respective sizes of the two `string_view`s to determine which is
// smaller, equal, or greater.
int compare(string_view x) const noexcept {
auto min_length = std::min(length_, x.length_);
if (min_length > 0) {
int r = memcmp(ptr_, x.ptr_, min_length);
if (r < 0) return -1;
if (r > 0) return 1;
}
if (length_ < x.length_) return -1;
if (length_ > x.length_) return 1;
return 0;
}
// Overload of `string_view::compare()` for comparing a substring of the
// 'string_view` and another `absl::string_view`.
int compare(size_type pos1, size_type count1, string_view v) const {
return substr(pos1, count1).compare(v);
}
// Overload of `string_view::compare()` for comparing a substring of the
// `string_view` and a substring of another `absl::string_view`.
int compare(size_type pos1, size_type count1, string_view v, size_type pos2,
size_type count2) const {
return substr(pos1, count1).compare(v.substr(pos2, count2));
}
// Overload of `string_view::compare()` for comparing a `string_view` and a
// a different C-style std::string `s`.
int compare(const char* s) const { return compare(string_view(s)); }
// Overload of `string_view::compare()` for comparing a substring of the
// `string_view` and a different std::string C-style std::string `s`.
int compare(size_type pos1, size_type count1, const char* s) const {
return substr(pos1, count1).compare(string_view(s));
}
// Overload of `string_view::compare()` for comparing a substring of the
// `string_view` and a substring of a different C-style std::string `s`.
int compare(size_type pos1, size_type count1, const char* s,
size_type count2) const {
return substr(pos1, count1).compare(string_view(s, count2));
}
// Find Utilities
// string_view::find()
//
// Finds the first occurrence of the substring `s` within the `string_view`,
// returning the position of the first character's match, or `npos` if no
// match was found.
size_type find(string_view s, size_type pos = 0) const noexcept;
// Overload of `string_view::find()` for finding the given character `c`
// within the `string_view`.
size_type find(char c, size_type pos = 0) const noexcept;
// string_view::rfind()
//
// Finds the last occurrence of a substring `s` within the `string_view`,
// returning the position of the first character's match, or `npos` if no
// match was found.
size_type rfind(string_view s, size_type pos = npos) const
noexcept;
// Overload of `string_view::rfind()` for finding the last given character `c`
// within the `string_view`.
size_type rfind(char c, size_type pos = npos) const noexcept;
// string_view::find_first_of()
//
// Finds the first occurrence of any of the characters in `s` within the
// `string_view`, returning the start position of the match, or `npos` if no
// match was found.
size_type find_first_of(string_view s, size_type pos = 0) const
noexcept;
// Overload of `string_view::find_first_of()` for finding a character `c`
// within the `string_view`.
size_type find_first_of(char c, size_type pos = 0) const
noexcept {
return find(c, pos);
}
// string_view::find_last_of()
//
// Finds the last occurrence of any of the characters in `s` within the
// `string_view`, returning the start position of the match, or `npos` if no
// match was found.
size_type find_last_of(string_view s, size_type pos = npos) const
noexcept;
// Overload of `string_view::find_last_of()` for finding a character `c`
// within the `string_view`.
size_type find_last_of(char c, size_type pos = npos) const
noexcept {
return rfind(c, pos);
}
// string_view::find_first_not_of()
//
// Finds the first occurrence of any of the characters not in `s` within the
// `string_view`, returning the start position of the first non-match, or
// `npos` if no non-match was found.
size_type find_first_not_of(string_view s, size_type pos = 0) const noexcept;
// Overload of `string_view::find_first_not_of()` for finding a character
// that is not `c` within the `string_view`.
size_type find_first_not_of(char c, size_type pos = 0) const noexcept;
// string_view::find_last_not_of()
//
// Finds the last occurrence of any of the characters not in `s` within the
// `string_view`, returning the start position of the last non-match, or
// `npos` if no non-match was found.
size_type find_last_not_of(string_view s,
size_type pos = npos) const noexcept;
// Overload of `string_view::find_last_not_of()` for finding a character
// that is not `c` within the `string_view`.
size_type find_last_not_of(char c, size_type pos = npos) const
noexcept;
private:
static constexpr size_type kMaxSize =
(std::numeric_limits<difference_type>::max)();
static constexpr size_type CheckLengthInternal(size_type len) {
return ABSL_ASSERT(len <= kMaxSize), len;
}
const char* ptr_;
size_type length_;
};
// This large function is defined inline so that in a fairly common case where
// one of the arguments is a literal, the compiler can elide a lot of the
// following comparisons.
inline bool operator==(string_view x, string_view y) noexcept {
auto len = x.size();
if (len != y.size()) {
return false;
}
return x.data() == y.data() || len <= 0 ||
memcmp(x.data(), y.data(), len) == 0;
}
inline bool operator!=(string_view x, string_view y) noexcept {
return !(x == y);
}
inline bool operator<(string_view x, string_view y) noexcept {
auto min_size = std::min(x.size(), y.size());
const int r = min_size == 0 ? 0 : memcmp(x.data(), y.data(), min_size);
return (r < 0) || (r == 0 && x.size() < y.size());
}
inline bool operator>(string_view x, string_view y) noexcept { return y < x; }
inline bool operator<=(string_view x, string_view y) noexcept {
return !(y < x);
}
inline bool operator>=(string_view x, string_view y) noexcept {
return !(x < y);
}
// IO Insertion Operator
std::ostream& operator<<(std::ostream& o, string_view piece);
} // namespace absl
#endif // ABSL_HAVE_STD_STRING_VIEW
namespace absl {
// ClippedSubstr()
//
// Like `s.substr(pos, n)`, but clips `pos` to an upper bound of `s.size()`.
// Provided because std::string_view::substr throws if `pos > size()`
inline string_view ClippedSubstr(string_view s, size_t pos,
size_t n = string_view::npos) {
pos = std::min(pos, static_cast<size_t>(s.size()));
return s.substr(pos, n);
}
// NullSafeStringView()
//
// Creates an `absl::string_view` from a pointer `p` even if it's null-valued.
// This function should be used where an `absl::string_view` can be created from
// a possibly-null pointer.
inline string_view NullSafeStringView(const char* p) {
return p ? string_view(p) : string_view();
}
} // namespace absl
#endif // ABSL_STRINGS_STRING_VIEW_H_

View File

@ -1,46 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/types/bad_optional_access.h"
#ifndef ABSL_HAVE_STD_OPTIONAL
#include <cstdlib>
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
namespace absl {
bad_optional_access::~bad_optional_access() = default;
const char* bad_optional_access::what() const noexcept {
return "optional has no value";
}
namespace optional_internal {
void throw_bad_optional_access() {
#ifdef ABSL_HAVE_EXCEPTIONS
throw bad_optional_access();
#else
ABSL_RAW_LOG(FATAL, "Bad optional access");
abort();
#endif
}
} // namespace optional_internal
} // namespace absl
#endif // ABSL_HAVE_STD_OPTIONAL

View File

@ -1,74 +0,0 @@
// Copyright 2018 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// -----------------------------------------------------------------------------
// bad_optional_access.h
// -----------------------------------------------------------------------------
//
// This header file defines the `absl::bad_optional_access` type.
#ifndef ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
#define ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_
#include <stdexcept>
#include "absl/base/config.h"
#ifdef ABSL_HAVE_STD_OPTIONAL
#include <optional>
namespace absl {
using std::bad_optional_access;
} // namespace absl
#else // ABSL_HAVE_STD_OPTIONAL
namespace absl {
// -----------------------------------------------------------------------------
// bad_optional_access
// -----------------------------------------------------------------------------
//
// An `absl::bad_optional_access` type is an exception type that is thrown when
// attempting to access an `absl::optional` object that does not contain a
// value.
//
// Example:
//
// absl::optional<int> o;
//
// try {
// int n = o.value();
// } catch(const absl::bad_optional_access& e) {
// std::cout << "Bad optional access: " << e.what() << '\n';
// }
class bad_optional_access : public std::exception {
public:
bad_optional_access() = default;
~bad_optional_access() override;
const char* what() const noexcept override;
};
namespace optional_internal {
// throw delegator
[[noreturn]] void throw_bad_optional_access();
} // namespace optional_internal
} // namespace absl
#endif // ABSL_HAVE_STD_OPTIONAL
#endif // ABSL_TYPES_BAD_OPTIONAL_ACCESS_H_

View File

@ -1,24 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "absl/types/optional.h"
#ifndef ABSL_HAVE_STD_OPTIONAL
namespace absl {
nullopt_t::init_t nullopt_t::init;
extern const nullopt_t nullopt{nullopt_t::init};
} // namespace absl
#endif // ABSL_HAVE_STD_OPTIONAL

File diff suppressed because it is too large Load Diff

View File

@ -1,291 +0,0 @@
// Copyright 2017 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This header file contains C++11 versions of standard <utility> header
// abstractions available within C++14 and C++17, and are designed to be drop-in
// replacement for code compliant with C++14 and C++17.
//
// The following abstractions are defined:
//
// * integer_sequence<T, Ints...> == std::integer_sequence<T, Ints...>
// * index_sequence<Ints...> == std::index_sequence<Ints...>
// * make_integer_sequence<T, N> == std::make_integer_sequence<T, N>
// * make_index_sequence<N> == std::make_index_sequence<N>
// * index_sequence_for<Ts...> == std::index_sequence_for<Ts...>
// * apply<Functor, Tuple> == std::apply<Functor, Tuple>
// * exchange<T> == std::exchange<T>
//
// This header file also provides the tag types `in_place_t`, `in_place_type_t`,
// and `in_place_index_t`, as well as the constant `in_place`, and
// `constexpr` `std::move()` and `std::forward()` implementations in C++11.
//
// References:
//
// http://en.cppreference.com/w/cpp/utility/integer_sequence
// http://en.cppreference.com/w/cpp/utility/apply
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3658.html
//
#ifndef ABSL_UTILITY_UTILITY_H_
#define ABSL_UTILITY_UTILITY_H_
#include <cstddef>
#include <cstdlib>
#include <tuple>
#include <utility>
#include "absl/base/config.h"
#include "absl/base/internal/inline_variable.h"
#include "absl/base/internal/invoke.h"
#include "absl/meta/type_traits.h"
namespace absl {
// integer_sequence
//
// Class template representing a compile-time integer sequence. An instantiation
// of `integer_sequence<T, Ints...>` has a sequence of integers encoded in its
// type through its template arguments (which is a common need when
// working with C++11 variadic templates). `absl::integer_sequence` is designed
// to be a drop-in replacement for C++14's `std::integer_sequence`.
//
// Example:
//
// template< class T, T... Ints >
// void user_function(integer_sequence<T, Ints...>);
//
// int main()
// {
// // user_function's `T` will be deduced to `int` and `Ints...`
// // will be deduced to `0, 1, 2, 3, 4`.
// user_function(make_integer_sequence<int, 5>());
// }
template <typename T, T... Ints>
struct integer_sequence {
using value_type = T;
static constexpr size_t size() noexcept { return sizeof...(Ints); }
};
// index_sequence
//
// A helper template for an `integer_sequence` of `size_t`,
// `absl::index_sequence` is designed to be a drop-in replacement for C++14's
// `std::index_sequence`.
template <size_t... Ints>
using index_sequence = integer_sequence<size_t, Ints...>;
namespace utility_internal {
template <typename Seq, size_t SeqSize, size_t Rem>
struct Extend;
// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency.
template <typename T, T... Ints, size_t SeqSize>
struct Extend<integer_sequence<T, Ints...>, SeqSize, 0> {
using type = integer_sequence<T, Ints..., (Ints + SeqSize)...>;
};
template <typename T, T... Ints, size_t SeqSize>
struct Extend<integer_sequence<T, Ints...>, SeqSize, 1> {
using type = integer_sequence<T, Ints..., (Ints + SeqSize)..., 2 * SeqSize>;
};
// Recursion helper for 'make_integer_sequence<T, N>'.
// 'Gen<T, N>::type' is an alias for 'integer_sequence<T, 0, 1, ... N-1>'.
template <typename T, size_t N>
struct Gen {
using type =
typename Extend<typename Gen<T, N / 2>::type, N / 2, N % 2>::type;
};
template <typename T>
struct Gen<T, 0> {
using type = integer_sequence<T>;
};
} // namespace utility_internal
// Compile-time sequences of integers
// make_integer_sequence
//
// This template alias is equivalent to
// `integer_sequence<int, 0, 1, ..., N-1>`, and is designed to be a drop-in
// replacement for C++14's `std::make_integer_sequence`.
template <typename T, T N>
using make_integer_sequence = typename utility_internal::Gen<T, N>::type;
// make_index_sequence
//
// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`,
// and is designed to be a drop-in replacement for C++14's
// `std::make_index_sequence`.
template <size_t N>
using make_index_sequence = make_integer_sequence<size_t, N>;
// index_sequence_for
//
// Converts a typename pack into an index sequence of the same length, and
// is designed to be a drop-in replacement for C++14's
// `std::index_sequence_for()`
template <typename... Ts>
using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
// Tag types
#ifdef ABSL_HAVE_STD_OPTIONAL
using std::in_place_t;
using std::in_place;
#else // ABSL_HAVE_STD_OPTIONAL
// in_place_t
//
// Tag type used to specify in-place construction, such as with
// `absl::optional`, designed to be a drop-in replacement for C++17's
// `std::in_place_t`.
struct in_place_t {};
ABSL_INTERNAL_INLINE_CONSTEXPR(in_place_t, in_place, {});
#endif // ABSL_HAVE_STD_OPTIONAL
#if defined(ABSL_HAVE_STD_ANY) || defined(ABSL_HAVE_STD_VARIANT)
using std::in_place_type_t;
#else
// in_place_type_t
//
// Tag type used for in-place construction when the type to construct needs to
// be specified, such as with `absl::any`, designed to be a drop-in replacement
// for C++17's `std::in_place_type_t`.
template <typename T>
struct in_place_type_t {};
#endif // ABSL_HAVE_STD_ANY || ABSL_HAVE_STD_VARIANT
#ifdef ABSL_HAVE_STD_VARIANT
using std::in_place_index_t;
#else
// in_place_index_t
//
// Tag type used for in-place construction when the type to construct needs to
// be specified, such as with `absl::any`, designed to be a drop-in replacement
// for C++17's `std::in_place_index_t`.
template <size_t I>
struct in_place_index_t {};
#endif // ABSL_HAVE_STD_VARIANT
// Constexpr move and forward
// move()
//
// A constexpr version of `std::move()`, designed to be a drop-in replacement
// for C++14's `std::move()`.
template <typename T>
constexpr absl::remove_reference_t<T>&& move(T&& t) noexcept {
return static_cast<absl::remove_reference_t<T>&&>(t);
}
// forward()
//
// A constexpr version of `std::forward()`, designed to be a drop-in replacement
// for C++14's `std::forward()`.
template <typename T>
constexpr T&& forward(
absl::remove_reference_t<T>& t) noexcept { // NOLINT(runtime/references)
return static_cast<T&&>(t);
}
namespace utility_internal {
// Helper method for expanding tuple into a called method.
template <typename Functor, typename Tuple, std::size_t... Indexes>
auto apply_helper(Functor&& functor, Tuple&& t, index_sequence<Indexes...>)
-> decltype(absl::base_internal::Invoke(
absl::forward<Functor>(functor),
std::get<Indexes>(absl::forward<Tuple>(t))...)) {
return absl::base_internal::Invoke(
absl::forward<Functor>(functor),
std::get<Indexes>(absl::forward<Tuple>(t))...);
}
} // namespace utility_internal
// apply
//
// Invokes a Callable using elements of a tuple as its arguments.
// Each element of the tuple corresponds to an argument of the call (in order).
// Both the Callable argument and the tuple argument are perfect-forwarded.
// For member-function Callables, the first tuple element acts as the `this`
// pointer. `absl::apply` is designed to be a drop-in replacement for C++17's
// `std::apply`. Unlike C++17's `std::apply`, this is not currently `constexpr`.
//
// Example:
//
// class Foo{void Bar(int);};
// void user_function(int, string);
// void user_function(std::unique_ptr<Foo>);
//
// int main()
// {
// std::tuple<int, string> tuple1(42, "bar");
// // Invokes the user function overload on int, string.
// absl::apply(&user_function, tuple1);
//
// auto foo = absl::make_unique<Foo>();
// std::tuple<Foo*, int> tuple2(foo.get(), 42);
// // Invokes the method Bar on foo with one argument 42.
// absl::apply(&Foo::Bar, foo.get(), 42);
//
// std::tuple<std::unique_ptr<Foo>> tuple3(absl::make_unique<Foo>());
// // Invokes the user function that takes ownership of the unique
// // pointer.
// absl::apply(&user_function, std::move(tuple));
// }
template <typename Functor, typename Tuple>
auto apply(Functor&& functor, Tuple&& t)
-> decltype(utility_internal::apply_helper(
absl::forward<Functor>(functor), absl::forward<Tuple>(t),
absl::make_index_sequence<std::tuple_size<
typename std::remove_reference<Tuple>::type>::value>{})) {
return utility_internal::apply_helper(
absl::forward<Functor>(functor), absl::forward<Tuple>(t),
absl::make_index_sequence<std::tuple_size<
typename std::remove_reference<Tuple>::type>::value>{});
}
// exchange
//
// Replaces the value of `obj` with `new_value` and returns the old value of
// `obj`. `absl::exchange` is designed to be a drop-in replacement for C++14's
// `std::exchange`.
//
// Example:
//
// Foo& operator=(Foo&& other) {
// ptr1_ = absl::exchange(other.ptr1_, nullptr);
// int1_ = absl::exchange(other.int1_, -1);
// return *this;
// }
template <typename T, typename U = T>
T exchange(T& obj, U&& new_value) {
T old_value = absl::move(obj);
obj = absl::forward<U>(new_value);
return old_value;
}
} // namespace absl
#endif // ABSL_UTILITY_UTILITY_H_

View File

@ -1,284 +0,0 @@
/*
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_ARRAY_VIEW_H_
#define API_ARRAY_VIEW_H_
#include <algorithm>
#include <array>
#include <type_traits>
#include "rtc_base/checks.h"
#include "rtc_base/type_traits.h"
namespace rtc {
// tl;dr: rtc::ArrayView is the same thing as gsl::span from the Guideline
// Support Library.
//
// Many functions read from or write to arrays. The obvious way to do this is
// to use two arguments, a pointer to the first element and an element count:
//
// bool Contains17(const int* arr, size_t size) {
// for (size_t i = 0; i < size; ++i) {
// if (arr[i] == 17)
// return true;
// }
// return false;
// }
//
// This is flexible, since it doesn't matter how the array is stored (C array,
// std::vector, rtc::Buffer, ...), but it's error-prone because the caller has
// to correctly specify the array length:
//
// Contains17(arr, arraysize(arr)); // C array
// Contains17(arr.data(), arr.size()); // std::vector
// Contains17(arr, size); // pointer + size
// ...
//
// It's also kind of messy to have two separate arguments for what is
// conceptually a single thing.
//
// Enter rtc::ArrayView<T>. It contains a T pointer (to an array it doesn't
// own) and a count, and supports the basic things you'd expect, such as
// indexing and iteration. It allows us to write our function like this:
//
// bool Contains17(rtc::ArrayView<const int> arr) {
// for (auto e : arr) {
// if (e == 17)
// return true;
// }
// return false;
// }
//
// And even better, because a bunch of things will implicitly convert to
// ArrayView, we can call it like this:
//
// Contains17(arr); // C array
// Contains17(arr); // std::vector
// Contains17(rtc::ArrayView<int>(arr, size)); // pointer + size
// Contains17(nullptr); // nullptr -> empty ArrayView
// ...
//
// ArrayView<T> stores both a pointer and a size, but you may also use
// ArrayView<T, N>, which has a size that's fixed at compile time (which means
// it only has to store the pointer).
//
// One important point is that ArrayView<T> and ArrayView<const T> are
// different types, which allow and don't allow mutation of the array elements,
// respectively. The implicit conversions work just like you'd hope, so that
// e.g. vector<int> will convert to either ArrayView<int> or ArrayView<const
// int>, but const vector<int> will convert only to ArrayView<const int>.
// (ArrayView itself can be the source type in such conversions, so
// ArrayView<int> will convert to ArrayView<const int>.)
//
// Note: ArrayView is tiny (just a pointer and a count if variable-sized, just
// a pointer if fix-sized) and trivially copyable, so it's probably cheaper to
// pass it by value than by const reference.
namespace impl {
// Magic constant for indicating that the size of an ArrayView is variable
// instead of fixed.
enum : std::ptrdiff_t { kArrayViewVarSize = -4711 };
// Base class for ArrayViews of fixed nonzero size.
template <typename T, std::ptrdiff_t Size>
class ArrayViewBase {
static_assert(Size > 0, "ArrayView size must be variable or non-negative");
public:
ArrayViewBase(T* data, size_t size) : data_(data) {}
static constexpr size_t size() { return Size; }
static constexpr bool empty() { return false; }
T* data() const { return data_; }
protected:
static constexpr bool fixed_size() { return true; }
private:
T* data_;
};
// Specialized base class for ArrayViews of fixed zero size.
template <typename T>
class ArrayViewBase<T, 0> {
public:
explicit ArrayViewBase(T* data, size_t size) {}
static constexpr size_t size() { return 0; }
static constexpr bool empty() { return true; }
T* data() const { return nullptr; }
protected:
static constexpr bool fixed_size() { return true; }
};
// Specialized base class for ArrayViews of variable size.
template <typename T>
class ArrayViewBase<T, impl::kArrayViewVarSize> {
public:
ArrayViewBase(T* data, size_t size)
: data_(size == 0 ? nullptr : data), size_(size) {}
size_t size() const { return size_; }
bool empty() const { return size_ == 0; }
T* data() const { return data_; }
protected:
static constexpr bool fixed_size() { return false; }
private:
T* data_;
size_t size_;
};
} // namespace impl
template <typename T, std::ptrdiff_t Size = impl::kArrayViewVarSize>
class ArrayView final : public impl::ArrayViewBase<T, Size> {
public:
using value_type = T;
using const_iterator = const T*;
// Construct an ArrayView from a pointer and a length.
template <typename U>
ArrayView(U* data, size_t size)
: impl::ArrayViewBase<T, Size>::ArrayViewBase(data, size) {
RTC_DCHECK_EQ(size == 0 ? nullptr : data, this->data());
RTC_DCHECK_EQ(size, this->size());
RTC_DCHECK_EQ(!this->data(),
this->size() == 0); // data is null iff size == 0.
}
// Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
// cannot be empty.
ArrayView() : ArrayView(nullptr, 0) {}
ArrayView(std::nullptr_t) // NOLINT
: ArrayView() {}
ArrayView(std::nullptr_t, size_t size)
: ArrayView(static_cast<T*>(nullptr), size) {
static_assert(Size == 0 || Size == impl::kArrayViewVarSize, "");
RTC_DCHECK_EQ(0, size);
}
// Construct an ArrayView from a C-style array.
template <typename U, size_t N>
ArrayView(U (&array)[N]) // NOLINT
: ArrayView(array, N) {
static_assert(Size == N || Size == impl::kArrayViewVarSize,
"Array size must match ArrayView size");
}
// (Only if size is fixed.) Construct a fixed size ArrayView<T, N> from a
// non-const std::array instance. For an ArrayView with variable size, the
// used ctor is ArrayView(U& u) instead.
template <typename U,
size_t N,
typename std::enable_if<
Size == static_cast<std::ptrdiff_t>(N)>::type* = nullptr>
ArrayView(std::array<U, N>& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
// (Only if size is fixed.) Construct a fixed size ArrayView<T, N> where T is
// const from a const(expr) std::array instance. For an ArrayView with
// variable size, the used ctor is ArrayView(U& u) instead.
template <typename U,
size_t N,
typename std::enable_if<
Size == static_cast<std::ptrdiff_t>(N)>::type* = nullptr>
ArrayView(const std::array<U, N>& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
// (Only if size is fixed.) Construct an ArrayView from any type U that has a
// static constexpr size() method whose return value is equal to Size, and a
// data() method whose return value converts implicitly to T*. In particular,
// this means we allow conversion from ArrayView<T, N> to ArrayView<const T,
// N>, but not the other way around. We also don't allow conversion from
// ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
// N> when M != N.
template <
typename U,
typename std::enable_if<Size != impl::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>::type* = nullptr>
ArrayView(U& u) // NOLINT
: ArrayView(u.data(), u.size()) {
static_assert(U::size() == Size, "Sizes must match exactly");
}
// (Only if size is variable.) Construct an ArrayView from any type U that
// has a size() method whose return value converts implicitly to size_t, and
// a data() method whose return value converts implicitly to T*. In
// particular, this means we allow conversion from ArrayView<T> to
// ArrayView<const T>, but not the other way around. Other allowed
// conversions include
// ArrayView<T, N> to ArrayView<T> or ArrayView<const T>,
// std::vector<T> to ArrayView<T> or ArrayView<const T>,
// const std::vector<T> to ArrayView<const T>,
// rtc::Buffer to ArrayView<uint8_t> or ArrayView<const uint8_t>, and
// const rtc::Buffer to ArrayView<const uint8_t>.
template <
typename U,
typename std::enable_if<Size == impl::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>::type* = nullptr>
ArrayView(U& u) // NOLINT
: ArrayView(u.data(), u.size()) {}
// Indexing and iteration. These allow mutation even if the ArrayView is
// const, because the ArrayView doesn't own the array. (To prevent mutation,
// use a const element type.)
T& operator[](size_t idx) const {
RTC_DCHECK_LT(idx, this->size());
RTC_DCHECK(this->data());
return this->data()[idx];
}
T* begin() const { return this->data(); }
T* end() const { return this->data() + this->size(); }
const T* cbegin() const { return this->data(); }
const T* cend() const { return this->data() + this->size(); }
ArrayView<T> subview(size_t offset, size_t size) const {
return offset < this->size()
? ArrayView<T>(this->data() + offset,
std::min(size, this->size() - offset))
: ArrayView<T>();
}
ArrayView<T> subview(size_t offset) const {
return subview(offset, this->size());
}
};
// Comparing two ArrayViews compares their (pointer,size) pairs; it does *not*
// dereference the pointers.
template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
bool operator==(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
return a.data() == b.data() && a.size() == b.size();
}
template <typename T, std::ptrdiff_t Size1, std::ptrdiff_t Size2>
bool operator!=(const ArrayView<T, Size1>& a, const ArrayView<T, Size2>& b) {
return !(a == b);
}
// Variable-size ArrayViews are the size of two pointers; fixed-size ArrayViews
// are the size of one pointer. (And as a special case, fixed-size ArrayViews
// of size 0 require no storage.)
static_assert(sizeof(ArrayView<int>) == 2 * sizeof(int*), "");
static_assert(sizeof(ArrayView<int, 17>) == sizeof(int*), "");
static_assert(std::is_empty<ArrayView<int, 0>>::value, "");
template <typename T>
inline ArrayView<T> MakeArrayView(T* data, size_t size) {
return ArrayView<T>(data, size);
}
} // namespace rtc
#endif // API_ARRAY_VIEW_H_

View File

@ -1,130 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/audio/audio_frame.h"
#include <string.h>
#include "rtc_base/checks.h"
#include "rtc_base/timeutils.h"
namespace webrtc {
AudioFrame::AudioFrame() {
// Visual Studio doesn't like this in the class definition.
static_assert(sizeof(data_) == kMaxDataSizeBytes, "kMaxDataSizeBytes");
}
void AudioFrame::Reset() {
ResetWithoutMuting();
muted_ = true;
}
void AudioFrame::ResetWithoutMuting() {
// TODO(wu): Zero is a valid value for |timestamp_|. We should initialize
// to an invalid value, or add a new member to indicate invalidity.
timestamp_ = 0;
elapsed_time_ms_ = -1;
ntp_time_ms_ = -1;
samples_per_channel_ = 0;
sample_rate_hz_ = 0;
num_channels_ = 0;
speech_type_ = kUndefined;
vad_activity_ = kVadUnknown;
profile_timestamp_ms_ = 0;
}
void AudioFrame::UpdateFrame(uint32_t timestamp,
const int16_t* data,
size_t samples_per_channel,
int sample_rate_hz,
SpeechType speech_type,
VADActivity vad_activity,
size_t num_channels) {
timestamp_ = timestamp;
samples_per_channel_ = samples_per_channel;
sample_rate_hz_ = sample_rate_hz;
speech_type_ = speech_type;
vad_activity_ = vad_activity;
num_channels_ = num_channels;
const size_t length = samples_per_channel * num_channels;
RTC_CHECK_LE(length, kMaxDataSizeSamples);
if (data != nullptr) {
memcpy(data_, data, sizeof(int16_t) * length);
muted_ = false;
} else {
muted_ = true;
}
}
void AudioFrame::CopyFrom(const AudioFrame& src) {
if (this == &src)
return;
timestamp_ = src.timestamp_;
elapsed_time_ms_ = src.elapsed_time_ms_;
ntp_time_ms_ = src.ntp_time_ms_;
muted_ = src.muted();
samples_per_channel_ = src.samples_per_channel_;
sample_rate_hz_ = src.sample_rate_hz_;
speech_type_ = src.speech_type_;
vad_activity_ = src.vad_activity_;
num_channels_ = src.num_channels_;
const size_t length = samples_per_channel_ * num_channels_;
RTC_CHECK_LE(length, kMaxDataSizeSamples);
if (!src.muted()) {
memcpy(data_, src.data(), sizeof(int16_t) * length);
muted_ = false;
}
}
void AudioFrame::UpdateProfileTimeStamp() {
profile_timestamp_ms_ = rtc::TimeMillis();
}
int64_t AudioFrame::ElapsedProfileTimeMs() const {
if (profile_timestamp_ms_ == 0) {
// Profiling has not been activated.
return -1;
}
return rtc::TimeSince(profile_timestamp_ms_);
}
const int16_t* AudioFrame::data() const {
return muted_ ? empty_data() : data_;
}
// TODO(henrik.lundin) Can we skip zeroing the buffer?
// See https://bugs.chromium.org/p/webrtc/issues/detail?id=5647.
int16_t* AudioFrame::mutable_data() {
if (muted_) {
memset(data_, 0, kMaxDataSizeBytes);
muted_ = false;
}
return data_;
}
void AudioFrame::Mute() {
muted_ = true;
}
bool AudioFrame::muted() const {
return muted_;
}
// static
const int16_t* AudioFrame::empty_data() {
static int16_t* null_data = new int16_t[kMaxDataSizeSamples]();
return &null_data[0];
}
} // namespace webrtc

View File

@ -1,132 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_AUDIO_AUDIO_FRAME_H_
#define API_AUDIO_AUDIO_FRAME_H_
#include <stddef.h>
#include <stdint.h>
#include "rtc_base/constructormagic.h"
namespace webrtc {
/* This class holds up to 120 ms of super-wideband (32 kHz) stereo audio. It
* allows for adding and subtracting frames while keeping track of the resulting
* states.
*
* Notes
* - This is a de-facto api, not designed for external use. The AudioFrame class
* is in need of overhaul or even replacement, and anyone depending on it
* should be prepared for that.
* - The total number of samples is samples_per_channel_ * num_channels_.
* - Stereo data is interleaved starting with the left channel.
*/
class AudioFrame {
public:
// Using constexpr here causes linker errors unless the variable also has an
// out-of-class definition, which is impractical in this header-only class.
// (This makes no sense because it compiles as an enum value, which we most
// certainly cannot take the address of, just fine.) C++17 introduces inline
// variables which should allow us to switch to constexpr and keep this a
// header-only class.
enum : size_t {
// Stereo, 32 kHz, 120 ms (2 * 32 * 120)
// Stereo, 192 kHz, 20 ms (2 * 192 * 20)
kMaxDataSizeSamples = 7680,
kMaxDataSizeBytes = kMaxDataSizeSamples * sizeof(int16_t),
};
enum VADActivity { kVadActive = 0, kVadPassive = 1, kVadUnknown = 2 };
enum SpeechType {
kNormalSpeech = 0,
kPLC = 1,
kCNG = 2,
kPLCCNG = 3,
kUndefined = 4
};
AudioFrame();
// Resets all members to their default state.
void Reset();
// Same as Reset(), but leaves mute state unchanged. Muting a frame requires
// the buffer to be zeroed on the next call to mutable_data(). Callers
// intending to write to the buffer immediately after Reset() can instead use
// ResetWithoutMuting() to skip this wasteful zeroing.
void ResetWithoutMuting();
void UpdateFrame(uint32_t timestamp,
const int16_t* data,
size_t samples_per_channel,
int sample_rate_hz,
SpeechType speech_type,
VADActivity vad_activity,
size_t num_channels = 1);
void CopyFrom(const AudioFrame& src);
// Sets a wall-time clock timestamp in milliseconds to be used for profiling
// of time between two points in the audio chain.
// Example:
// t0: UpdateProfileTimeStamp()
// t1: ElapsedProfileTimeMs() => t1 - t0 [msec]
void UpdateProfileTimeStamp();
// Returns the time difference between now and when UpdateProfileTimeStamp()
// was last called. Returns -1 if UpdateProfileTimeStamp() has not yet been
// called.
int64_t ElapsedProfileTimeMs() const;
// data() returns a zeroed static buffer if the frame is muted.
// mutable_frame() always returns a non-static buffer; the first call to
// mutable_frame() zeros the non-static buffer and marks the frame unmuted.
const int16_t* data() const;
int16_t* mutable_data();
// Prefer to mute frames using AudioFrameOperations::Mute.
void Mute();
// Frame is muted by default.
bool muted() const;
// RTP timestamp of the first sample in the AudioFrame.
uint32_t timestamp_ = 0;
// Time since the first frame in milliseconds.
// -1 represents an uninitialized value.
int64_t elapsed_time_ms_ = -1;
// NTP time of the estimated capture time in local timebase in milliseconds.
// -1 represents an uninitialized value.
int64_t ntp_time_ms_ = -1;
size_t samples_per_channel_ = 0;
int sample_rate_hz_ = 0;
size_t num_channels_ = 0;
SpeechType speech_type_ = kUndefined;
VADActivity vad_activity_ = kVadUnknown;
// Monotonically increasing timestamp intended for profiling of audio frames.
// Typically used for measuring elapsed time between two different points in
// the audio path. No lock is used to save resources and we are thread safe
// by design. Also, absl::optional is not used since it will cause a "complex
// class/struct needs an explicit out-of-line destructor" build error.
int64_t profile_timestamp_ms_ = 0;
private:
// A permamently zeroed out buffer to represent muted frames. This is a
// header-only class, so the only way to avoid creating a separate empty
// buffer per translation unit is to wrap a static in an inline function.
static const int16_t* empty_data();
int16_t data_[kMaxDataSizeSamples];
bool muted_ = true;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioFrame);
};
} // namespace webrtc
#endif // API_AUDIO_AUDIO_FRAME_H_

View File

@ -1,248 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/audio/echo_canceller3_config.h"
#include <algorithm>
#include <cmath>
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_minmax.h"
namespace webrtc {
namespace {
bool Limit(float* value, float min, float max) {
float clamped = rtc::SafeClamp(*value, min, max);
clamped = std::isfinite(clamped) ? clamped : min;
bool res = *value == clamped;
*value = clamped;
return res;
}
bool Limit(size_t* value, size_t min, size_t max) {
size_t clamped = rtc::SafeClamp(*value, min, max);
bool res = *value == clamped;
*value = clamped;
return res;
}
bool Limit(int* value, int min, int max) {
int clamped = rtc::SafeClamp(*value, min, max);
bool res = *value == clamped;
*value = clamped;
return res;
}
} // namespace
EchoCanceller3Config::EchoCanceller3Config() = default;
EchoCanceller3Config::EchoCanceller3Config(const EchoCanceller3Config& e) =
default;
EchoCanceller3Config::Delay::Delay() = default;
EchoCanceller3Config::Delay::Delay(const EchoCanceller3Config::Delay& e) =
default;
EchoCanceller3Config::EchoModel::EchoModel() = default;
EchoCanceller3Config::EchoModel::EchoModel(
const EchoCanceller3Config::EchoModel& e) = default;
EchoCanceller3Config::Suppressor::Suppressor() = default;
EchoCanceller3Config::Suppressor::Suppressor(
const EchoCanceller3Config::Suppressor& e) = default;
EchoCanceller3Config::Suppressor::MaskingThresholds::MaskingThresholds(
float enr_transparent,
float enr_suppress,
float emr_transparent)
: enr_transparent(enr_transparent),
enr_suppress(enr_suppress),
emr_transparent(emr_transparent) {}
EchoCanceller3Config::Suppressor::Suppressor::MaskingThresholds::
MaskingThresholds(
const EchoCanceller3Config::Suppressor::MaskingThresholds& e) = default;
EchoCanceller3Config::Suppressor::Tuning::Tuning(MaskingThresholds mask_lf,
MaskingThresholds mask_hf,
float max_inc_factor,
float max_dec_factor_lf)
: mask_lf(mask_lf),
mask_hf(mask_hf),
max_inc_factor(max_inc_factor),
max_dec_factor_lf(max_dec_factor_lf) {}
EchoCanceller3Config::Suppressor::Tuning::Tuning(
const EchoCanceller3Config::Suppressor::Tuning& e) = default;
bool EchoCanceller3Config::Validate(EchoCanceller3Config* config) {
RTC_DCHECK(config);
EchoCanceller3Config* c = config;
bool res = true;
if (c->delay.down_sampling_factor != 4 &&
c->delay.down_sampling_factor != 8) {
c->delay.down_sampling_factor = 4;
res = false;
}
if (c->delay.delay_headroom_blocks <= 1 &&
c->delay.hysteresis_limit_1_blocks == 1) {
c->delay.hysteresis_limit_1_blocks = 0;
res = false;
}
res = res & Limit(&c->delay.default_delay, 0, 5000);
res = res & Limit(&c->delay.num_filters, 0, 5000);
res = res & Limit(&c->delay.api_call_jitter_blocks, 1, 5000);
res = res & Limit(&c->delay.min_echo_path_delay_blocks, 0, 5000);
res = res & Limit(&c->delay.delay_headroom_blocks, 0, 5000);
res = res & Limit(&c->delay.hysteresis_limit_1_blocks, 0, 5000);
res = res & Limit(&c->delay.hysteresis_limit_2_blocks, 0, 5000);
res = res & Limit(&c->delay.skew_hysteresis_blocks, 0, 5000);
res = res & Limit(&c->delay.fixed_capture_delay_samples, 0, 5000);
res = res & Limit(&c->delay.delay_estimate_smoothing, 0.f, 1.f);
res = res & Limit(&c->delay.delay_candidate_detection_threshold, 0.f, 1.f);
res = res & Limit(&c->delay.delay_selection_thresholds.initial, 1, 250);
res = res & Limit(&c->delay.delay_selection_thresholds.converged, 1, 250);
res = res & Limit(&c->filter.main.length_blocks, 1, 50);
res = res & Limit(&c->filter.main.leakage_converged, 0.f, 1000.f);
res = res & Limit(&c->filter.main.leakage_diverged, 0.f, 1000.f);
res = res & Limit(&c->filter.main.error_floor, 0.f, 1000.f);
res = res & Limit(&c->filter.main.error_ceil, 0.f, 100000000.f);
res = res & Limit(&c->filter.main.noise_gate, 0.f, 100000000.f);
res = res & Limit(&c->filter.main_initial.length_blocks, 1, 50);
res = res & Limit(&c->filter.main_initial.leakage_converged, 0.f, 1000.f);
res = res & Limit(&c->filter.main_initial.leakage_diverged, 0.f, 1000.f);
res = res & Limit(&c->filter.main_initial.error_floor, 0.f, 1000.f);
res = res & Limit(&c->filter.main_initial.error_ceil, 0.f, 100000000.f);
res = res & Limit(&c->filter.main_initial.noise_gate, 0.f, 100000000.f);
if (c->filter.main.length_blocks < c->filter.main_initial.length_blocks) {
c->filter.main_initial.length_blocks = c->filter.main.length_blocks;
res = false;
}
res = res & Limit(&c->filter.shadow.length_blocks, 1, 50);
res = res & Limit(&c->filter.shadow.rate, 0.f, 1.f);
res = res & Limit(&c->filter.shadow.noise_gate, 0.f, 100000000.f);
res = res & Limit(&c->filter.shadow_initial.length_blocks, 1, 50);
res = res & Limit(&c->filter.shadow_initial.rate, 0.f, 1.f);
res = res & Limit(&c->filter.shadow_initial.noise_gate, 0.f, 100000000.f);
if (c->filter.shadow.length_blocks < c->filter.shadow_initial.length_blocks) {
c->filter.shadow_initial.length_blocks = c->filter.shadow.length_blocks;
res = false;
}
res = res & Limit(&c->filter.config_change_duration_blocks, 0, 100000);
res = res & Limit(&c->filter.initial_state_seconds, 0.f, 100.f);
res = res & Limit(&c->erle.min, 1.f, 100000.f);
res = res & Limit(&c->erle.max_l, 1.f, 100000.f);
res = res & Limit(&c->erle.max_h, 1.f, 100000.f);
if (c->erle.min > c->erle.max_l || c->erle.min > c->erle.max_h) {
c->erle.min = std::min(c->erle.max_l, c->erle.max_h);
res = false;
}
res = res & Limit(&c->ep_strength.lf, 0.f, 1000000.f);
res = res & Limit(&c->ep_strength.mf, 0.f, 1000000.f);
res = res & Limit(&c->ep_strength.hf, 0.f, 1000000.f);
res = res & Limit(&c->ep_strength.default_len, 0.f, 1.f);
res =
res & Limit(&c->echo_audibility.low_render_limit, 0.f, 32768.f * 32768.f);
res = res &
Limit(&c->echo_audibility.normal_render_limit, 0.f, 32768.f * 32768.f);
res = res & Limit(&c->echo_audibility.floor_power, 0.f, 32768.f * 32768.f);
res = res & Limit(&c->echo_audibility.audibility_threshold_lf, 0.f,
32768.f * 32768.f);
res = res & Limit(&c->echo_audibility.audibility_threshold_mf, 0.f,
32768.f * 32768.f);
res = res & Limit(&c->echo_audibility.audibility_threshold_hf, 0.f,
32768.f * 32768.f);
res = res &
Limit(&c->render_levels.active_render_limit, 0.f, 32768.f * 32768.f);
res = res & Limit(&c->render_levels.poor_excitation_render_limit, 0.f,
32768.f * 32768.f);
res = res & Limit(&c->render_levels.poor_excitation_render_limit_ds8, 0.f,
32768.f * 32768.f);
res =
res & Limit(&c->echo_removal_control.gain_rampup.initial_gain, 0.f, 1.f);
res = res & Limit(&c->echo_removal_control.gain_rampup.first_non_zero_gain,
0.f, 1.f);
res = res & Limit(&c->echo_removal_control.gain_rampup.non_zero_gain_blocks,
0, 100000);
res = res &
Limit(&c->echo_removal_control.gain_rampup.full_gain_blocks, 0, 100000);
res = res & Limit(&c->echo_model.noise_floor_hold, 0, 1000);
res = res & Limit(&c->echo_model.min_noise_floor_power, 0, 2000000.f);
res = res & Limit(&c->echo_model.stationary_gate_slope, 0, 1000000.f);
res = res & Limit(&c->echo_model.noise_gate_power, 0, 1000000.f);
res = res & Limit(&c->echo_model.noise_gate_slope, 0, 1000000.f);
res = res & Limit(&c->echo_model.render_pre_window_size, 0, 100);
res = res & Limit(&c->echo_model.render_post_window_size, 0, 100);
res = res & Limit(&c->echo_model.render_pre_window_size_init, 0, 100);
res = res & Limit(&c->echo_model.render_post_window_size_init, 0, 100);
res = res & Limit(&c->echo_model.nonlinear_hold, 0, 100);
res = res & Limit(&c->echo_model.nonlinear_release, 0, 1.f);
res = res & Limit(&c->suppressor.nearend_average_blocks, 1, 5000);
res = res &
Limit(&c->suppressor.normal_tuning.mask_lf.enr_transparent, 0.f, 100.f);
res = res &
Limit(&c->suppressor.normal_tuning.mask_lf.enr_suppress, 0.f, 100.f);
res = res &
Limit(&c->suppressor.normal_tuning.mask_lf.emr_transparent, 0.f, 100.f);
res = res &
Limit(&c->suppressor.normal_tuning.mask_hf.enr_transparent, 0.f, 100.f);
res = res &
Limit(&c->suppressor.normal_tuning.mask_hf.enr_suppress, 0.f, 100.f);
res = res &
Limit(&c->suppressor.normal_tuning.mask_hf.emr_transparent, 0.f, 100.f);
res = res & Limit(&c->suppressor.normal_tuning.max_inc_factor, 0.f, 100.f);
res = res & Limit(&c->suppressor.normal_tuning.max_dec_factor_lf, 0.f, 100.f);
res = res & Limit(&c->suppressor.nearend_tuning.mask_lf.enr_transparent, 0.f,
100.f);
res = res &
Limit(&c->suppressor.nearend_tuning.mask_lf.enr_suppress, 0.f, 100.f);
res = res & Limit(&c->suppressor.nearend_tuning.mask_lf.emr_transparent, 0.f,
100.f);
res = res & Limit(&c->suppressor.nearend_tuning.mask_hf.enr_transparent, 0.f,
100.f);
res = res &
Limit(&c->suppressor.nearend_tuning.mask_hf.enr_suppress, 0.f, 100.f);
res = res & Limit(&c->suppressor.nearend_tuning.mask_hf.emr_transparent, 0.f,
100.f);
res = res & Limit(&c->suppressor.nearend_tuning.max_inc_factor, 0.f, 100.f);
res =
res & Limit(&c->suppressor.nearend_tuning.max_dec_factor_lf, 0.f, 100.f);
res = res & Limit(&c->suppressor.dominant_nearend_detection.enr_threshold,
0.f, 1000000.f);
res = res & Limit(&c->suppressor.dominant_nearend_detection.snr_threshold,
0.f, 1000000.f);
res = res & Limit(&c->suppressor.dominant_nearend_detection.hold_duration, 0,
10000);
res = res & Limit(&c->suppressor.dominant_nearend_detection.trigger_threshold,
0, 10000);
res = res & Limit(&c->suppressor.high_bands_suppression.enr_threshold, 0.f,
1000000.f);
res = res & Limit(&c->suppressor.high_bands_suppression.max_gain_during_echo,
0.f, 1.f);
res = res & Limit(&c->suppressor.floor_first_increase, 0.f, 1000000.f);
return res;
}
} // namespace webrtc

View File

@ -1,204 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
#define API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
#include <stddef.h> // size_t
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// Configuration struct for EchoCanceller3
struct RTC_EXPORT EchoCanceller3Config {
// Checks and updates the config parameters to lie within (mostly) reasonable
// ranges. Returns true if and only of the config did not need to be changed.
static bool Validate(EchoCanceller3Config* config);
EchoCanceller3Config();
EchoCanceller3Config(const EchoCanceller3Config& e);
struct Buffering {
bool use_new_render_buffering = true;
size_t excess_render_detection_interval_blocks = 250;
size_t max_allowed_excess_render_blocks = 8;
} buffering;
struct Delay {
Delay();
Delay(const Delay& e);
size_t default_delay = 5;
size_t down_sampling_factor = 4;
size_t num_filters = 5;
size_t api_call_jitter_blocks = 26;
size_t min_echo_path_delay_blocks = 0;
size_t delay_headroom_blocks = 2;
size_t hysteresis_limit_1_blocks = 1;
size_t hysteresis_limit_2_blocks = 1;
size_t skew_hysteresis_blocks = 3;
size_t fixed_capture_delay_samples = 0;
float delay_estimate_smoothing = 0.7f;
float delay_candidate_detection_threshold = 0.2f;
struct DelaySelectionThresholds {
int initial;
int converged;
} delay_selection_thresholds = {5, 20};
} delay;
struct Filter {
struct MainConfiguration {
size_t length_blocks;
float leakage_converged;
float leakage_diverged;
float error_floor;
float error_ceil;
float noise_gate;
};
struct ShadowConfiguration {
size_t length_blocks;
float rate;
float noise_gate;
};
MainConfiguration main = {13, 0.00005f, 0.05f, 0.001f, 2.f, 20075344.f};
ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
MainConfiguration main_initial = {12, 0.005f, 0.5f,
0.001f, 2.f, 20075344.f};
ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
size_t config_change_duration_blocks = 250;
float initial_state_seconds = 2.5f;
bool conservative_initial_phase = false;
bool enable_shadow_filter_output_usage = true;
} filter;
struct Erle {
float min = 1.f;
float max_l = 4.f;
float max_h = 1.5f;
bool onset_detection = true;
} erle;
struct EpStrength {
float lf = 1.f;
float mf = 1.f;
float hf = 1.f;
float default_len = 0.83f;
bool reverb_based_on_render = true;
bool echo_can_saturate = true;
bool bounded_erl = false;
} ep_strength;
struct EchoAudibility {
float low_render_limit = 4 * 64.f;
float normal_render_limit = 64.f;
float floor_power = 2 * 64.f;
float audibility_threshold_lf = 10;
float audibility_threshold_mf = 10;
float audibility_threshold_hf = 10;
bool use_stationary_properties = false;
bool use_stationarity_properties_at_init = false;
} echo_audibility;
struct RenderLevels {
float active_render_limit = 100.f;
float poor_excitation_render_limit = 150.f;
float poor_excitation_render_limit_ds8 = 20.f;
} render_levels;
struct EchoRemovalControl {
struct GainRampup {
float initial_gain = 0.0f;
float first_non_zero_gain = 0.001f;
int non_zero_gain_blocks = 187;
int full_gain_blocks = 312;
} gain_rampup;
bool has_clock_drift = false;
bool linear_and_stable_echo_path = false;
} echo_removal_control;
struct EchoModel {
EchoModel();
EchoModel(const EchoModel& e);
size_t noise_floor_hold = 50;
float min_noise_floor_power = 1638400.f;
float stationary_gate_slope = 10.f;
float noise_gate_power = 27509.42f;
float noise_gate_slope = 0.3f;
size_t render_pre_window_size = 1;
size_t render_post_window_size = 1;
size_t render_pre_window_size_init = 10;
size_t render_post_window_size_init = 10;
float nonlinear_hold = 1;
float nonlinear_release = 0.001f;
} echo_model;
struct Suppressor {
Suppressor();
Suppressor(const Suppressor& e);
size_t nearend_average_blocks = 4;
struct MaskingThresholds {
MaskingThresholds(float enr_transparent,
float enr_suppress,
float emr_transparent);
MaskingThresholds(const MaskingThresholds& e);
float enr_transparent;
float enr_suppress;
float emr_transparent;
};
struct Tuning {
Tuning(MaskingThresholds mask_lf,
MaskingThresholds mask_hf,
float max_inc_factor,
float max_dec_factor_lf);
Tuning(const Tuning& e);
MaskingThresholds mask_lf;
MaskingThresholds mask_hf;
float max_inc_factor;
float max_dec_factor_lf;
};
Tuning normal_tuning = Tuning(MaskingThresholds(.3f, .4f, .3f),
MaskingThresholds(.07f, .1f, .3f),
2.0f,
0.25f);
Tuning nearend_tuning = Tuning(MaskingThresholds(1.09f, 1.1f, .3f),
MaskingThresholds(.1f, .3f, .3f),
2.0f,
0.25f);
struct DominantNearendDetection {
float enr_threshold = 4.f;
float enr_exit_threshold = .1f;
float snr_threshold = 30.f;
int hold_duration = 50;
int trigger_threshold = 12;
bool use_during_initial_phase = true;
} dominant_nearend_detection;
struct HighBandsSuppression {
float enr_threshold = 1.f;
float max_gain_during_echo = 1.f;
} high_bands_suppression;
float floor_first_increase = 0.00001f;
bool enforce_transparent = false;
bool enforce_empty_higher_bands = false;
} suppressor;
};
} // namespace webrtc
#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_

View File

@ -1,27 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/audio/echo_canceller3_factory.h"
#include <memory>
#include "absl/memory/memory.h"
#include "modules/audio_processing/aec3/echo_canceller3.h"
namespace webrtc {
EchoCanceller3Factory::EchoCanceller3Factory() {}
EchoCanceller3Factory::EchoCanceller3Factory(const EchoCanceller3Config& config)
: config_(config) {}
std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(int sample_rate_hz) {
return absl::make_unique<EchoCanceller3>(config_, sample_rate_hz, true);
}
} // namespace webrtc

View File

@ -1,39 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_AUDIO_ECHO_CANCELLER3_FACTORY_H_
#define API_AUDIO_ECHO_CANCELLER3_FACTORY_H_
#include <memory>
#include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
class RTC_EXPORT EchoCanceller3Factory : public EchoControlFactory {
public:
// Factory producing EchoCanceller3 instances with the default configuration.
EchoCanceller3Factory();
// Factory producing EchoCanceller3 instances with the specified
// configuration.
explicit EchoCanceller3Factory(const EchoCanceller3Config& config);
// Creates an EchoCanceller3 running at the specified sampling rate.
std::unique_ptr<EchoControl> Create(int sample_rate_hz) override;
private:
const EchoCanceller3Config config_;
};
} // namespace webrtc
#endif // API_AUDIO_ECHO_CANCELLER3_FACTORY_H_

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_AUDIO_ECHO_CONTROL_H_
#define API_AUDIO_ECHO_CONTROL_H_
#include <memory>
namespace webrtc {
class AudioBuffer;
// Interface for an acoustic echo cancellation (AEC) submodule.
class EchoControl {
public:
// Analysis (not changing) of the render signal.
virtual void AnalyzeRender(AudioBuffer* render) = 0;
// Analysis (not changing) of the capture signal.
virtual void AnalyzeCapture(AudioBuffer* capture) = 0;
// Processes the capture signal in order to remove the echo.
virtual void ProcessCapture(AudioBuffer* capture, bool echo_path_change) = 0;
struct Metrics {
double echo_return_loss;
double echo_return_loss_enhancement;
int delay_ms;
};
// Collect current metrics from the echo controller.
virtual Metrics GetMetrics() const = 0;
// Provides an optional external estimate of the audio buffer delay.
virtual void SetAudioBufferDelay(size_t delay_ms) = 0;
virtual ~EchoControl() {}
};
// Interface for a factory that creates EchoControllers.
class EchoControlFactory {
public:
virtual std::unique_ptr<EchoControl> Create(int sample_rate_hz) = 0;
virtual ~EchoControlFactory() = default;
};
} // namespace webrtc
#endif // API_AUDIO_ECHO_CONTROL_H_

View File

@ -1,221 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/audio_converter.h"
#include <cstring>
#include <memory>
#include <utility>
#include <vector>
#include "common_audio/channel_buffer.h"
#include "common_audio/resampler/push_sinc_resampler.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_conversions.h"
using rtc::checked_cast;
namespace webrtc {
class CopyConverter : public AudioConverter {
public:
CopyConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames)
: AudioConverter(src_channels, src_frames, dst_channels, dst_frames) {}
~CopyConverter() override{};
void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) override {
CheckSizes(src_size, dst_capacity);
if (src != dst) {
for (size_t i = 0; i < src_channels(); ++i)
std::memcpy(dst[i], src[i], dst_frames() * sizeof(*dst[i]));
}
}
};
class UpmixConverter : public AudioConverter {
public:
UpmixConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames)
: AudioConverter(src_channels, src_frames, dst_channels, dst_frames) {}
~UpmixConverter() override{};
void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) override {
CheckSizes(src_size, dst_capacity);
for (size_t i = 0; i < dst_frames(); ++i) {
const float value = src[0][i];
for (size_t j = 0; j < dst_channels(); ++j)
dst[j][i] = value;
}
}
};
class DownmixConverter : public AudioConverter {
public:
DownmixConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames)
: AudioConverter(src_channels, src_frames, dst_channels, dst_frames) {}
~DownmixConverter() override{};
void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) override {
CheckSizes(src_size, dst_capacity);
float* dst_mono = dst[0];
for (size_t i = 0; i < src_frames(); ++i) {
float sum = 0;
for (size_t j = 0; j < src_channels(); ++j)
sum += src[j][i];
dst_mono[i] = sum / src_channels();
}
}
};
class ResampleConverter : public AudioConverter {
public:
ResampleConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames)
: AudioConverter(src_channels, src_frames, dst_channels, dst_frames) {
resamplers_.reserve(src_channels);
for (size_t i = 0; i < src_channels; ++i)
resamplers_.push_back(std::unique_ptr<PushSincResampler>(
new PushSincResampler(src_frames, dst_frames)));
}
~ResampleConverter() override{};
void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) override {
CheckSizes(src_size, dst_capacity);
for (size_t i = 0; i < resamplers_.size(); ++i)
resamplers_[i]->Resample(src[i], src_frames(), dst[i], dst_frames());
}
private:
std::vector<std::unique_ptr<PushSincResampler>> resamplers_;
};
// Apply a vector of converters in serial, in the order given. At least two
// converters must be provided.
class CompositionConverter : public AudioConverter {
public:
explicit CompositionConverter(
std::vector<std::unique_ptr<AudioConverter>> converters)
: converters_(std::move(converters)) {
RTC_CHECK_GE(converters_.size(), 2);
// We need an intermediate buffer after every converter.
for (auto it = converters_.begin(); it != converters_.end() - 1; ++it)
buffers_.push_back(
std::unique_ptr<ChannelBuffer<float>>(new ChannelBuffer<float>(
(*it)->dst_frames(), (*it)->dst_channels())));
}
~CompositionConverter() override{};
void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) override {
converters_.front()->Convert(src, src_size, buffers_.front()->channels(),
buffers_.front()->size());
for (size_t i = 2; i < converters_.size(); ++i) {
auto& src_buffer = buffers_[i - 2];
auto& dst_buffer = buffers_[i - 1];
converters_[i]->Convert(src_buffer->channels(), src_buffer->size(),
dst_buffer->channels(), dst_buffer->size());
}
converters_.back()->Convert(buffers_.back()->channels(),
buffers_.back()->size(), dst, dst_capacity);
}
private:
std::vector<std::unique_ptr<AudioConverter>> converters_;
std::vector<std::unique_ptr<ChannelBuffer<float>>> buffers_;
};
std::unique_ptr<AudioConverter> AudioConverter::Create(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames) {
std::unique_ptr<AudioConverter> sp;
if (src_channels > dst_channels) {
if (src_frames != dst_frames) {
std::vector<std::unique_ptr<AudioConverter>> converters;
converters.push_back(std::unique_ptr<AudioConverter>(new DownmixConverter(
src_channels, src_frames, dst_channels, src_frames)));
converters.push_back(
std::unique_ptr<AudioConverter>(new ResampleConverter(
dst_channels, src_frames, dst_channels, dst_frames)));
sp.reset(new CompositionConverter(std::move(converters)));
} else {
sp.reset(new DownmixConverter(src_channels, src_frames, dst_channels,
dst_frames));
}
} else if (src_channels < dst_channels) {
if (src_frames != dst_frames) {
std::vector<std::unique_ptr<AudioConverter>> converters;
converters.push_back(
std::unique_ptr<AudioConverter>(new ResampleConverter(
src_channels, src_frames, src_channels, dst_frames)));
converters.push_back(std::unique_ptr<AudioConverter>(new UpmixConverter(
src_channels, dst_frames, dst_channels, dst_frames)));
sp.reset(new CompositionConverter(std::move(converters)));
} else {
sp.reset(new UpmixConverter(src_channels, src_frames, dst_channels,
dst_frames));
}
} else if (src_frames != dst_frames) {
sp.reset(new ResampleConverter(src_channels, src_frames, dst_channels,
dst_frames));
} else {
sp.reset(
new CopyConverter(src_channels, src_frames, dst_channels, dst_frames));
}
return sp;
}
// For CompositionConverter.
AudioConverter::AudioConverter()
: src_channels_(0), src_frames_(0), dst_channels_(0), dst_frames_(0) {}
AudioConverter::AudioConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames)
: src_channels_(src_channels),
src_frames_(src_frames),
dst_channels_(dst_channels),
dst_frames_(dst_frames) {
RTC_CHECK(dst_channels == src_channels || dst_channels == 1 ||
src_channels == 1);
}
void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const {
RTC_CHECK_EQ(src_size, src_channels() * src_frames());
RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames());
}
} // namespace webrtc

View File

@ -1,72 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_AUDIO_CONVERTER_H_
#define COMMON_AUDIO_AUDIO_CONVERTER_H_
#include <stddef.h>
#include <memory>
#include "rtc_base/constructormagic.h"
namespace webrtc {
// Format conversion (remixing and resampling) for audio. Only simple remixing
// conversions are supported: downmix to mono (i.e. |dst_channels| == 1) or
// upmix from mono (i.e. |src_channels == 1|).
//
// The source and destination chunks have the same duration in time; specifying
// the number of frames is equivalent to specifying the sample rates.
class AudioConverter {
public:
// Returns a new AudioConverter, which will use the supplied format for its
// lifetime. Caller is responsible for the memory.
static std::unique_ptr<AudioConverter> Create(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames);
virtual ~AudioConverter() {}
// Convert |src|, containing |src_size| samples, to |dst|, having a sample
// capacity of |dst_capacity|. Both point to a series of buffers containing
// the samples for each channel. The sizes must correspond to the format
// passed to Create().
virtual void Convert(const float* const* src,
size_t src_size,
float* const* dst,
size_t dst_capacity) = 0;
size_t src_channels() const { return src_channels_; }
size_t src_frames() const { return src_frames_; }
size_t dst_channels() const { return dst_channels_; }
size_t dst_frames() const { return dst_frames_; }
protected:
AudioConverter();
AudioConverter(size_t src_channels,
size_t src_frames,
size_t dst_channels,
size_t dst_frames);
// Helper to RTC_CHECK that inputs are correctly sized.
void CheckSizes(size_t src_size, size_t dst_capacity) const;
private:
const size_t src_channels_;
const size_t src_frames_;
const size_t dst_channels_;
const size_t dst_frames_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioConverter);
};
} // namespace webrtc
#endif // COMMON_AUDIO_AUDIO_CONVERTER_H_

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/include/audio_util.h"
namespace webrtc {
void FloatToS16(const float* src, size_t size, int16_t* dest) {
for (size_t i = 0; i < size; ++i)
dest[i] = FloatToS16(src[i]);
}
void S16ToFloat(const int16_t* src, size_t size, float* dest) {
for (size_t i = 0; i < size; ++i)
dest[i] = S16ToFloat(src[i]);
}
void FloatS16ToS16(const float* src, size_t size, int16_t* dest) {
for (size_t i = 0; i < size; ++i)
dest[i] = FloatS16ToS16(src[i]);
}
void FloatToFloatS16(const float* src, size_t size, float* dest) {
for (size_t i = 0; i < size; ++i)
dest[i] = FloatToFloatS16(src[i]);
}
void FloatS16ToFloat(const float* src, size_t size, float* dest) {
for (size_t i = 0; i < size; ++i)
dest[i] = FloatS16ToFloat(src[i]);
}
template <>
void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved,
size_t num_frames,
int num_channels,
int16_t* deinterleaved) {
DownmixInterleavedToMonoImpl<int16_t, int32_t>(interleaved, num_frames,
num_channels, deinterleaved);
}
} // namespace webrtc

View File

@ -1,184 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_CHANNEL_BUFFER_H_
#define COMMON_AUDIO_CHANNEL_BUFFER_H_
#include <string.h>
#include <memory>
#include "common_audio/include/audio_util.h"
#include "rtc_base/checks.h"
#include "rtc_base/gtest_prod_util.h"
namespace webrtc {
// Helper to encapsulate a contiguous data buffer, full or split into frequency
// bands, with access to a pointer arrays of the deinterleaved channels and
// bands. The buffer is zero initialized at creation.
//
// The buffer structure is showed below for a 2 channel and 2 bands case:
//
// |data_|:
// { [ --- b1ch1 --- ] [ --- b2ch1 --- ] [ --- b1ch2 --- ] [ --- b2ch2 --- ] }
//
// The pointer arrays for the same example are as follows:
//
// |channels_|:
// { [ b1ch1* ] [ b1ch2* ] [ b2ch1* ] [ b2ch2* ] }
//
// |bands_|:
// { [ b1ch1* ] [ b2ch1* ] [ b1ch2* ] [ b2ch2* ] }
template <typename T>
class ChannelBuffer {
public:
ChannelBuffer(size_t num_frames, size_t num_channels, size_t num_bands = 1)
: data_(new T[num_frames * num_channels]()),
channels_(new T*[num_channels * num_bands]),
bands_(new T*[num_channels * num_bands]),
num_frames_(num_frames),
num_frames_per_band_(num_frames / num_bands),
num_allocated_channels_(num_channels),
num_channels_(num_channels),
num_bands_(num_bands) {
for (size_t i = 0; i < num_allocated_channels_; ++i) {
for (size_t j = 0; j < num_bands_; ++j) {
channels_[j * num_allocated_channels_ + i] =
&data_[i * num_frames_ + j * num_frames_per_band_];
bands_[i * num_bands_ + j] = channels_[j * num_allocated_channels_ + i];
}
}
}
// Returns a pointer array to the full-band channels (or lower band channels).
// Usage:
// channels()[channel][sample].
// Where:
// 0 <= channel < |num_allocated_channels_|
// 0 <= sample < |num_frames_|
T* const* channels() { return channels(0); }
const T* const* channels() const { return channels(0); }
// Returns a pointer array to the channels for a specific band.
// Usage:
// channels(band)[channel][sample].
// Where:
// 0 <= band < |num_bands_|
// 0 <= channel < |num_allocated_channels_|
// 0 <= sample < |num_frames_per_band_|
const T* const* channels(size_t band) const {
RTC_DCHECK_LT(band, num_bands_);
return &channels_[band * num_allocated_channels_];
}
T* const* channels(size_t band) {
const ChannelBuffer<T>* t = this;
return const_cast<T* const*>(t->channels(band));
}
// Returns a pointer array to the bands for a specific channel.
// Usage:
// bands(channel)[band][sample].
// Where:
// 0 <= channel < |num_channels_|
// 0 <= band < |num_bands_|
// 0 <= sample < |num_frames_per_band_|
const T* const* bands(size_t channel) const {
RTC_DCHECK_LT(channel, num_channels_);
RTC_DCHECK_GE(channel, 0);
return &bands_[channel * num_bands_];
}
T* const* bands(size_t channel) {
const ChannelBuffer<T>* t = this;
return const_cast<T* const*>(t->bands(channel));
}
// Sets the |slice| pointers to the |start_frame| position for each channel.
// Returns |slice| for convenience.
const T* const* Slice(T** slice, size_t start_frame) const {
RTC_DCHECK_LT(start_frame, num_frames_);
for (size_t i = 0; i < num_channels_; ++i)
slice[i] = &channels_[i][start_frame];
return slice;
}
T** Slice(T** slice, size_t start_frame) {
const ChannelBuffer<T>* t = this;
return const_cast<T**>(t->Slice(slice, start_frame));
}
size_t num_frames() const { return num_frames_; }
size_t num_frames_per_band() const { return num_frames_per_band_; }
size_t num_channels() const { return num_channels_; }
size_t num_bands() const { return num_bands_; }
size_t size() const { return num_frames_ * num_allocated_channels_; }
void set_num_channels(size_t num_channels) {
RTC_DCHECK_LE(num_channels, num_allocated_channels_);
num_channels_ = num_channels;
}
void SetDataForTesting(const T* data, size_t size) {
RTC_CHECK_EQ(size, this->size());
memcpy(data_.get(), data, size * sizeof(*data));
}
private:
std::unique_ptr<T[]> data_;
std::unique_ptr<T* []> channels_;
std::unique_ptr<T* []> bands_;
const size_t num_frames_;
const size_t num_frames_per_band_;
// Number of channels the internal buffer holds.
const size_t num_allocated_channels_;
// Number of channels the user sees.
size_t num_channels_;
const size_t num_bands_;
};
// One int16_t and one float ChannelBuffer that are kept in sync. The sync is
// broken when someone requests write access to either ChannelBuffer, and
// reestablished when someone requests the outdated ChannelBuffer. It is
// therefore safe to use the return value of ibuf_const() and fbuf_const()
// until the next call to ibuf() or fbuf(), and the return value of ibuf() and
// fbuf() until the next call to any of the other functions.
class IFChannelBuffer {
public:
IFChannelBuffer(size_t num_frames, size_t num_channels, size_t num_bands = 1);
~IFChannelBuffer();
ChannelBuffer<int16_t>* ibuf();
ChannelBuffer<float>* fbuf();
const ChannelBuffer<int16_t>* ibuf_const() const;
const ChannelBuffer<float>* fbuf_const() const;
size_t num_frames() const { return ibuf_.num_frames(); }
size_t num_frames_per_band() const { return ibuf_.num_frames_per_band(); }
size_t num_channels() const {
return ivalid_ ? ibuf_.num_channels() : fbuf_.num_channels();
}
void set_num_channels(size_t num_channels) {
ibuf_.set_num_channels(num_channels);
fbuf_.set_num_channels(num_channels);
}
size_t num_bands() const { return ibuf_.num_bands(); }
private:
void RefreshF() const;
void RefreshI() const;
mutable bool ivalid_;
mutable ChannelBuffer<int16_t> ibuf_;
mutable bool fvalid_;
mutable ChannelBuffer<float> fbuf_;
};
} // namespace webrtc
#endif // COMMON_AUDIO_CHANNEL_BUFFER_H_

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/fir_filter_c.h"
#include <string.h>
#include <memory>
#include "rtc_base/checks.h"
namespace webrtc {
FIRFilterC::~FIRFilterC() {}
FIRFilterC::FIRFilterC(const float* coefficients, size_t coefficients_length)
: coefficients_length_(coefficients_length),
state_length_(coefficients_length - 1),
coefficients_(new float[coefficients_length_]),
state_(new float[state_length_]) {
for (size_t i = 0; i < coefficients_length_; ++i) {
coefficients_[i] = coefficients[coefficients_length_ - i - 1];
}
memset(state_.get(), 0, state_length_ * sizeof(state_[0]));
}
void FIRFilterC::Filter(const float* in, size_t length, float* out) {
RTC_DCHECK_GT(length, 0);
// Convolves the input signal |in| with the filter kernel |coefficients_|
// taking into account the previous state.
for (size_t i = 0; i < length; ++i) {
out[i] = 0.f;
size_t j;
for (j = 0; state_length_ > i && j < state_length_ - i; ++j) {
out[i] += state_[i + j] * coefficients_[j];
}
for (; j < coefficients_length_; ++j) {
out[i] += in[j + i - state_length_] * coefficients_[j];
}
}
// Update current state.
if (length >= state_length_) {
memcpy(state_.get(), &in[length - state_length_],
state_length_ * sizeof(*in));
} else {
memmove(state_.get(), &state_[length],
(state_length_ - length) * sizeof(state_[0]));
memcpy(&state_[state_length_ - length], in, length * sizeof(*in));
}
}
} // namespace webrtc

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_FIR_FILTER_C_H_
#define COMMON_AUDIO_FIR_FILTER_C_H_
#include <string.h>
#include <memory>
#include "common_audio/fir_filter.h"
namespace webrtc {
class FIRFilterC : public FIRFilter {
public:
FIRFilterC(const float* coefficients, size_t coefficients_length);
~FIRFilterC() override;
void Filter(const float* in, size_t length, float* out) override;
private:
size_t coefficients_length_;
size_t state_length_;
std::unique_ptr<float[]> coefficients_;
std::unique_ptr<float[]> state_;
};
} // namespace webrtc
#endif // COMMON_AUDIO_FIR_FILTER_C_H_

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/fir_filter_factory.h"
#include "common_audio/fir_filter_c.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/arch.h"
#if defined(WEBRTC_ARCH_ARM_FAMILY) && defined(WEBRTC_HAS_NEON)
#include "common_audio/fir_filter_neon.h"
#elif defined(WEBRTC_ARCH_X86_FAMILY)
#include "common_audio/fir_filter_sse.h"
#include "system_wrappers/include/cpu_features_wrapper.h" // kSSE2, WebRtc_G...
#endif
namespace webrtc {
FIRFilter* CreateFirFilter(const float* coefficients,
size_t coefficients_length,
size_t max_input_length) {
if (!coefficients || coefficients_length <= 0 || max_input_length <= 0) {
RTC_NOTREACHED();
return nullptr;
}
FIRFilter* filter = nullptr;
// If we know the minimum architecture at compile time, avoid CPU detection.
#if defined(WEBRTC_ARCH_X86_FAMILY)
#if defined(__SSE2__)
filter =
new FIRFilterSSE2(coefficients, coefficients_length, max_input_length);
#else
// x86 CPU detection required.
if (WebRtc_GetCPUInfo(kSSE2)) {
filter =
new FIRFilterSSE2(coefficients, coefficients_length, max_input_length);
} else {
filter = new FIRFilterC(coefficients, coefficients_length);
}
#endif
#elif defined(WEBRTC_HAS_NEON)
filter =
new FIRFilterNEON(coefficients, coefficients_length, max_input_length);
#else
filter = new FIRFilterC(coefficients, coefficients_length);
#endif
return filter;
}
} // namespace webrtc

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#if defined(__arm__) || defined(_M_ARM) || defined(__aarch64__)
#include "common_audio/fir_filter_neon.h"
#include <arm_neon.h>
#include <string.h>
#include "rtc_base/checks.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {
FIRFilterNEON::~FIRFilterNEON() {}
FIRFilterNEON::FIRFilterNEON(const float* coefficients,
size_t coefficients_length,
size_t max_input_length)
: // Closest higher multiple of four.
coefficients_length_((coefficients_length + 3) & ~0x03),
state_length_(coefficients_length_ - 1),
coefficients_(static_cast<float*>(
AlignedMalloc(sizeof(float) * coefficients_length_, 16))),
state_(static_cast<float*>(
AlignedMalloc(sizeof(float) * (max_input_length + state_length_),
16))) {
// Add zeros at the end of the coefficients.
size_t padding = coefficients_length_ - coefficients_length;
memset(coefficients_.get(), 0.f, padding * sizeof(coefficients_[0]));
// The coefficients are reversed to compensate for the order in which the
// input samples are acquired (most recent last).
for (size_t i = 0; i < coefficients_length; ++i) {
coefficients_[i + padding] = coefficients[coefficients_length - i - 1];
}
memset(state_.get(), 0.f,
(max_input_length + state_length_) * sizeof(state_[0]));
}
void FIRFilterNEON::Filter(const float* in, size_t length, float* out) {
RTC_DCHECK_GT(length, 0);
memcpy(&state_[state_length_], in, length * sizeof(*in));
// Convolves the input signal |in| with the filter kernel |coefficients_|
// taking into account the previous state.
for (size_t i = 0; i < length; ++i) {
float* in_ptr = &state_[i];
float* coef_ptr = coefficients_.get();
float32x4_t m_sum = vmovq_n_f32(0);
float32x4_t m_in;
for (size_t j = 0; j < coefficients_length_; j += 4) {
m_in = vld1q_f32(in_ptr + j);
m_sum = vmlaq_f32(m_sum, m_in, vld1q_f32(coef_ptr + j));
}
float32x2_t m_half = vadd_f32(vget_high_f32(m_sum), vget_low_f32(m_sum));
out[i] = vget_lane_f32(vpadd_f32(m_half, m_half), 0);
}
// Update current state.
memmove(state_.get(), &state_[length], state_length_ * sizeof(state_[0]));
}
} // namespace webrtc
#endif

View File

@ -1,86 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/system/arch.h"
#ifdef WEBRTC_ARCH_X86_FAMILY
#include "common_audio/fir_filter_sse.h"
#include <stdint.h>
#include <string.h>
#include <xmmintrin.h>
#include "rtc_base/checks.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {
FIRFilterSSE2::~FIRFilterSSE2() {}
FIRFilterSSE2::FIRFilterSSE2(const float* coefficients,
size_t coefficients_length,
size_t max_input_length)
: // Closest higher multiple of four.
coefficients_length_((coefficients_length + 3) & ~0x03),
state_length_(coefficients_length_ - 1),
coefficients_(static_cast<float*>(
AlignedMalloc(sizeof(float) * coefficients_length_, 16))),
state_(static_cast<float*>(
AlignedMalloc(sizeof(float) * (max_input_length + state_length_),
16))) {
// Add zeros at the end of the coefficients.
size_t padding = coefficients_length_ - coefficients_length;
memset(coefficients_.get(), 0, padding * sizeof(coefficients_[0]));
// The coefficients are reversed to compensate for the order in which the
// input samples are acquired (most recent last).
for (size_t i = 0; i < coefficients_length; ++i) {
coefficients_[i + padding] = coefficients[coefficients_length - i - 1];
}
memset(state_.get(), 0,
(max_input_length + state_length_) * sizeof(state_[0]));
}
void FIRFilterSSE2::Filter(const float* in, size_t length, float* out) {
RTC_DCHECK_GT(length, 0);
memcpy(&state_[state_length_], in, length * sizeof(*in));
// Convolves the input signal |in| with the filter kernel |coefficients_|
// taking into account the previous state.
for (size_t i = 0; i < length; ++i) {
float* in_ptr = &state_[i];
float* coef_ptr = coefficients_.get();
__m128 m_sum = _mm_setzero_ps();
__m128 m_in;
// Depending on if the pointer is aligned with 16 bytes or not it is loaded
// differently.
if (reinterpret_cast<uintptr_t>(in_ptr) & 0x0F) {
for (size_t j = 0; j < coefficients_length_; j += 4) {
m_in = _mm_loadu_ps(in_ptr + j);
m_sum = _mm_add_ps(m_sum, _mm_mul_ps(m_in, _mm_load_ps(coef_ptr + j)));
}
} else {
for (size_t j = 0; j < coefficients_length_; j += 4) {
m_in = _mm_load_ps(in_ptr + j);
m_sum = _mm_add_ps(m_sum, _mm_mul_ps(m_in, _mm_load_ps(coef_ptr + j)));
}
}
m_sum = _mm_add_ps(_mm_movehl_ps(m_sum, m_sum), m_sum);
_mm_store_ss(out + i, _mm_add_ss(m_sum, _mm_shuffle_ps(m_sum, m_sum, 1)));
}
// Update current state.
memmove(state_.get(), &state_[length], state_length_ * sizeof(state_[0]));
}
} // namespace webrtc
#endif

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_FIR_FILTER_SSE_H_
#define COMMON_AUDIO_FIR_FILTER_SSE_H_
#include <stddef.h>
#include <memory>
#include "common_audio/fir_filter.h"
#include "rtc_base/memory/aligned_malloc.h"
namespace webrtc {
class FIRFilterSSE2 : public FIRFilter {
public:
FIRFilterSSE2(const float* coefficients,
size_t coefficients_length,
size_t max_input_length);
~FIRFilterSSE2() override;
void Filter(const float* in, size_t length, float* out) override;
private:
size_t coefficients_length_;
size_t state_length_;
std::unique_ptr<float[], AlignedFreeDeleter> coefficients_;
std::unique_ptr<float[], AlignedFreeDeleter> state_;
};
} // namespace webrtc
#endif // COMMON_AUDIO_FIR_FILTER_SSE_H_

View File

@ -1,214 +0,0 @@
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_
#define COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <limits>
#include "rtc_base/checks.h"
namespace webrtc {
typedef std::numeric_limits<int16_t> limits_int16;
// The conversion functions use the following naming convention:
// S16: int16_t [-32768, 32767]
// Float: float [-1.0, 1.0]
// FloatS16: float [-32768.0, 32767.0]
// Dbfs: float [-20.0*log(10, 32768), 0] = [-90.3, 0]
// The ratio conversion functions use this naming convention:
// Ratio: float (0, +inf)
// Db: float (-inf, +inf)
static inline int16_t FloatToS16(float v) {
if (v > 0)
return v >= 1 ? limits_int16::max()
: static_cast<int16_t>(v * limits_int16::max() + 0.5f);
return v <= -1 ? limits_int16::min()
: static_cast<int16_t>(-v * limits_int16::min() - 0.5f);
}
static inline float S16ToFloat(int16_t v) {
static const float kMaxInt16Inverse = 1.f / limits_int16::max();
static const float kMinInt16Inverse = 1.f / limits_int16::min();
return v * (v > 0 ? kMaxInt16Inverse : -kMinInt16Inverse);
}
static inline int16_t FloatS16ToS16(float v) {
static const float kMaxRound = limits_int16::max() - 0.5f;
static const float kMinRound = limits_int16::min() + 0.5f;
if (v > 0)
return v >= kMaxRound ? limits_int16::max()
: static_cast<int16_t>(v + 0.5f);
return v <= kMinRound ? limits_int16::min() : static_cast<int16_t>(v - 0.5f);
}
static inline float FloatToFloatS16(float v) {
return v * (v > 0 ? limits_int16::max() : -limits_int16::min());
}
static inline float FloatS16ToFloat(float v) {
static const float kMaxInt16Inverse = 1.f / limits_int16::max();
static const float kMinInt16Inverse = 1.f / limits_int16::min();
return v * (v > 0 ? kMaxInt16Inverse : -kMinInt16Inverse);
}
void FloatToS16(const float* src, size_t size, int16_t* dest);
void S16ToFloat(const int16_t* src, size_t size, float* dest);
void FloatS16ToS16(const float* src, size_t size, int16_t* dest);
void FloatToFloatS16(const float* src, size_t size, float* dest);
void FloatS16ToFloat(const float* src, size_t size, float* dest);
inline float DbToRatio(float v) {
return std::pow(10.0f, v / 20.0f);
}
inline float DbfsToFloatS16(float v) {
static constexpr float kMaximumAbsFloatS16 = -limits_int16::min();
return DbToRatio(v) * kMaximumAbsFloatS16;
}
inline float FloatS16ToDbfs(float v) {
RTC_DCHECK_GE(v, 0);
// kMinDbfs is equal to -20.0 * log10(-limits_int16::min())
static constexpr float kMinDbfs = -90.30899869919436f;
if (v <= 1.0f) {
return kMinDbfs;
}
// Equal to 20 * log10(v / (-limits_int16::min()))
return 20.0f * std::log10(v) + kMinDbfs;
}
// Copy audio from |src| channels to |dest| channels unless |src| and |dest|
// point to the same address. |src| and |dest| must have the same number of
// channels, and there must be sufficient space allocated in |dest|.
template <typename T>
void CopyAudioIfNeeded(const T* const* src,
int num_frames,
int num_channels,
T* const* dest) {
for (int i = 0; i < num_channels; ++i) {
if (src[i] != dest[i]) {
std::copy(src[i], src[i] + num_frames, dest[i]);
}
}
}
// Deinterleave audio from |interleaved| to the channel buffers pointed to
// by |deinterleaved|. There must be sufficient space allocated in the
// |deinterleaved| buffers (|num_channel| buffers with |samples_per_channel|
// per buffer).
template <typename T>
void Deinterleave(const T* interleaved,
size_t samples_per_channel,
size_t num_channels,
T* const* deinterleaved) {
for (size_t i = 0; i < num_channels; ++i) {
T* channel = deinterleaved[i];
size_t interleaved_idx = i;
for (size_t j = 0; j < samples_per_channel; ++j) {
channel[j] = interleaved[interleaved_idx];
interleaved_idx += num_channels;
}
}
}
// Interleave audio from the channel buffers pointed to by |deinterleaved| to
// |interleaved|. There must be sufficient space allocated in |interleaved|
// (|samples_per_channel| * |num_channels|).
template <typename T>
void Interleave(const T* const* deinterleaved,
size_t samples_per_channel,
size_t num_channels,
T* interleaved) {
for (size_t i = 0; i < num_channels; ++i) {
const T* channel = deinterleaved[i];
size_t interleaved_idx = i;
for (size_t j = 0; j < samples_per_channel; ++j) {
interleaved[interleaved_idx] = channel[j];
interleaved_idx += num_channels;
}
}
}
// Copies audio from a single channel buffer pointed to by |mono| to each
// channel of |interleaved|. There must be sufficient space allocated in
// |interleaved| (|samples_per_channel| * |num_channels|).
template <typename T>
void UpmixMonoToInterleaved(const T* mono,
int num_frames,
int num_channels,
T* interleaved) {
int interleaved_idx = 0;
for (int i = 0; i < num_frames; ++i) {
for (int j = 0; j < num_channels; ++j) {
interleaved[interleaved_idx++] = mono[i];
}
}
}
template <typename T, typename Intermediate>
void DownmixToMono(const T* const* input_channels,
size_t num_frames,
int num_channels,
T* out) {
for (size_t i = 0; i < num_frames; ++i) {
Intermediate value = input_channels[0][i];
for (int j = 1; j < num_channels; ++j) {
value += input_channels[j][i];
}
out[i] = value / num_channels;
}
}
// Downmixes an interleaved multichannel signal to a single channel by averaging
// all channels.
template <typename T, typename Intermediate>
void DownmixInterleavedToMonoImpl(const T* interleaved,
size_t num_frames,
int num_channels,
T* deinterleaved) {
RTC_DCHECK_GT(num_channels, 0);
RTC_DCHECK_GT(num_frames, 0);
const T* const end = interleaved + num_frames * num_channels;
while (interleaved < end) {
const T* const frame_end = interleaved + num_channels;
Intermediate value = *interleaved++;
while (interleaved < frame_end) {
value += *interleaved++;
}
*deinterleaved++ = value / num_channels;
}
}
template <typename T>
void DownmixInterleavedToMono(const T* interleaved,
size_t num_frames,
int num_channels,
T* deinterleaved);
template <>
void DownmixInterleavedToMono<int16_t>(const int16_t* interleaved,
size_t num_frames,
int num_channels,
int16_t* deinterleaved);
} // namespace webrtc
#endif // COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_

View File

@ -1,28 +0,0 @@
/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_MOCKS_MOCK_SMOOTHING_FILTER_H_
#define COMMON_AUDIO_MOCKS_MOCK_SMOOTHING_FILTER_H_
#include "common_audio/smoothing_filter.h"
#include "test/gmock.h"
namespace webrtc {
class MockSmoothingFilter : public SmoothingFilter {
public:
MOCK_METHOD1(AddSample, void(float));
MOCK_METHOD0(GetAverage, absl::optional<float>());
MOCK_METHOD1(SetTimeConstantMs, bool(int));
};
} // namespace webrtc
#endif // COMMON_AUDIO_MOCKS_MOCK_SMOOTHING_FILTER_H_

Some files were not shown because too many files have changed in this diff Show More