Additional updates for sim_arm64

This commit is contained in:
Ali 2020-12-17 16:27:06 +04:00
parent 25a64e87e9
commit 5e35d3d815
6 changed files with 29 additions and 86 deletions

View File

@ -53,6 +53,6 @@ bazel_skylib_workspace()
http_file(
name = "cmake_tar_gz",
urls = ["https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Darwin-x86_64.tar.gz"],
sha256 = "9d27049660474cf134ab46fa0e0db771b263313fcb8ba82ee8b2d1a1a62f8f20",
urls = ["https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-macos-universal.tar.gz"],
sha256 = "50afa2cb66bea6a0314ef28034f3ff1647325e30cf5940f97906a56fd9640bd8",
)

View File

@ -7,6 +7,7 @@ copts_arm = [
"-DWEBRTC_NS_FLOAT",
"-DWEBRTC_IOS",
"-DWEBRTC_HAS_NEON",
"-DTGVOIP_NO_DSP",
]
copts_x86 = [
@ -14,52 +15,11 @@ copts_x86 = [
"-DWEBRTC_APM_DEBUG_DUMP=0",
"-DWEBRTC_POSIX",
"-DTGVOIP_HAVE_TGLOG",
"-DTGVOIP_NO_DSP",
"-DWEBRTC_NS_FLOAT",
"-DWEBRTC_IOS",
]
replace_symbols = [
"WebRtcAgc_Process",
"rtc_FatalMessage",
"WebRtcAgc_UpdateAgcThresholds",
"WebRtcAgc_Init",
"WebRtcAgc_GetAddFarendError",
"WebRtcAgc_ZeroCtrl",
"WebRtcAgc_SaturationCtrl",
"WebRtcAgc_SpeakerInactiveCtrl",
"WebRtcAgc_ProcessAnalog",
"WebRtcAgc_set_config",
"WebRtcAgc_get_config",
"WebRtcAgc_ExpCurve",
"WebRtcAgc_Create",
"WebRtcAgc_Free",
"WebRtcAgc_AddFarend",
"WebRtcAgc_VirtualMic",
"WebRtcAgc_AddMic",
"WebRtcAgc_InitDigital",
"WebRtcAgc_AddFarendToDigital",
"WebRtcAgc_CalculateGainTable",
"WebRtcAgc_InitVad",
"WebRtcAgc_ProcessVad",
"TimeDiff",
"TimeAfter",
"TimeMicros",
"TimeUTCMicros",
"SystemTimeNanos",
"TimeNanos",
"SystemTimeMillis",
"TimeMillis",
"TimeUTCMillis",
"GetClockForTesting",
"TimestampWrapAroundHandler",
"Time32",
"TmToSeconds",
"TimeDiff32",
"TimestampWrapAroundHandler",
"g_clock",
"SetClockForTesting",
]
objc_library(
name = "TgVoip",
enable_modules = True,
@ -77,9 +37,6 @@ objc_library(
"libtgvoip/os/darwin/*.mm",
"libtgvoip/os/darwin/*.cpp",
"libtgvoip/os/posix/*.cpp",
"libtgvoip/webrtc_dsp/**/*.c",
"libtgvoip/webrtc_dsp/**/*.cc",
"libtgvoip/webrtc_dsp/**/*.cpp",
], exclude = ["libtgvoip/os/darwin/*OSX*"]),
hdrs = glob([
"PublicHeaders/**/*.h",
@ -87,12 +44,12 @@ objc_library(
copts = [
"-I{}/PublicHeaders/TgVoip".format(package_name()),
"-I{}/libtgvoip".format(package_name()),
"-I{}/libtgvoip/webrtc_dsp".format(package_name()),
"-I{}/third-party/webrtc/webrtc-ios/src".format(package_name()),
"-Isubmodules/Opus/Public/opus",
"-DTGVOIP_USE_INSTALLED_OPUS",
"-Drtc=rtc1",
"-Dwebrtc=webrtc1",
] + ["-D{symbol}={symbol}1".format(symbol=symbol) for symbol in replace_symbols] + select({
] + select({
"@build_bazel_rules_apple//apple:ios_armv7": copts_arm,
"@build_bazel_rules_apple//apple:ios_arm64": copts_arm,
"//build-system:ios_sim_arm64": copts_arm,

View File

@ -127,7 +127,7 @@ static void withContext(int32_t contextId, void (^f)(OngoingCallThreadLocalConte
NSTimeInterval _callConnectTimeout;
NSTimeInterval _callPacketTimeout;
TgVoip *_tgVoip;
std::unique_ptr<TgVoip> _tgVoip;
OngoingCallState _state;
int32_t _signalBars;
@ -262,45 +262,32 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
endpoints.push_back(endpoint);
}
TgVoipConfig config = {
.initializationTimeout = _callConnectTimeout,
.receiveTimeout = _callPacketTimeout,
.dataSaving = callControllerDataSavingForType(dataSaving),
.enableP2P = static_cast<bool>(allowP2P),
.enableAEC = false,
.enableNS = true,
.enableAGC = true,
.enableCallUpgrade = false,
.logPath = logPath.length == 0 ? "" : std::string(logPath.UTF8String),
.maxApiLayer = [OngoingCallThreadLocalContext maxLayer]
};
TgVoipConfig config;
config.initializationTimeout = _callConnectTimeout;
config.receiveTimeout = _callPacketTimeout;
config.dataSaving = callControllerDataSavingForType(dataSaving);
config.enableP2P = static_cast<bool>(allowP2P);
config.enableAEC = false;
config.enableNS = true;
config.enableAGC = true;
config.enableVolumeControl = false;
config.enableCallUpgrade = false;
config.logPath = logPath.length == 0 ? "" : std::string(logPath.UTF8String);
config.maxApiLayer = [OngoingCallThreadLocalContext maxLayer];
std::vector<uint8_t> encryptionKeyValue;
encryptionKeyValue.resize(key.length);
memcpy(encryptionKeyValue.data(), key.bytes, key.length);
TgVoipEncryptionKey encryptionKey = {
.value = encryptionKeyValue,
.isOutgoing = isOutgoing,
};
/*
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
*/
TgVoipEncryptionKey encryptionKey;
encryptionKey.value = encryptionKeyValue;
encryptionKey.isOutgoing = isOutgoing;
_tgVoip = TgVoip::makeInstance(
config,
{ derivedStateValue },
endpoints,
proxyValue,
proxyValue.get(),
callControllerNetworkTypeForType(networkType),
encryptionKey,
crypto
@ -341,8 +328,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
NSString *debugLog = [NSString stringWithUTF8String:finalState.debugLog.c_str()];
_lastDerivedState = [[NSData alloc] initWithBytes:finalState.persistentState.value.data() length:finalState.persistentState.value.size()];
delete _tgVoip;
_tgVoip = NULL;
_tgVoip.reset();
if (completion) {
completion(debugLog, finalState.trafficStats.bytesSentWifi, finalState.trafficStats.bytesReceivedWifi, finalState.trafficStats.bytesSentMobile, finalState.trafficStats.bytesReceivedMobile);
@ -381,7 +367,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
- (void)controllerStateChanged:(TgVoipState)state {
OngoingCallState callState = OngoingCallStateInitializing;
switch (state) {
case TgVoipState::Estabilished:
case TgVoipState::Established:
callState = OngoingCallStateConnected;
break;
case TgVoipState::Failed:

@ -1 +1 @@
Subproject commit dc4e9ec48207388e41db1c2ef1cccf9899d9765f
Subproject commit 37d98e984fd6fa389262307db826d52ab86c8241

View File

@ -57,7 +57,7 @@ genrule(
mkdir -p "$$BUILD_DIR/Public/mozjpeg"
PATH="$$PATH:$$CMAKE_DIR/cmake-3.18.4-Darwin-x86_64/CMake.app/Contents/bin" sh $$BUILD_DIR/build-mozjpeg-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/mozjpeg" "$$BUILD_DIR"
PATH="$$PATH:$$CMAKE_DIR/cmake-3.19.2-macos-universal/CMake.app/Contents/bin" sh $$BUILD_DIR/build-mozjpeg-bazel.sh $$BUILD_ARCH "$$BUILD_DIR/mozjpeg" "$$BUILD_DIR"
""" +
"\n".join([
"cp -f \"$$BUILD_DIR/mozjpeg/{}\" \"$(location Public/mozjpeg/{})\"".format(header, header) for header in headers

View File

@ -23,8 +23,8 @@ set -x
pushd "$$BUILD_DIR/yasm-1.3.0"
mkdir build
cd build
PATH="$$PATH:$$CMAKE_DIR/cmake-3.18.4-Darwin-x86_64/CMake.app/Contents/bin" arch -x86_64 cmake .. -DYASM_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
arch -x86_64 make -j $$core_count
PATH="$$PATH:$$CMAKE_DIR/cmake-3.19.2-macos-universal/CMake.app/Contents/bin" cmake .. -DYASM_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
make -j $$core_count
popd
tar -cf "$(location yasm.tar)" -C "$$BUILD_DIR/yasm-1.3.0/build" .