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( http_file(
name = "cmake_tar_gz", name = "cmake_tar_gz",
urls = ["https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Darwin-x86_64.tar.gz"], urls = ["https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2-macos-universal.tar.gz"],
sha256 = "9d27049660474cf134ab46fa0e0db771b263313fcb8ba82ee8b2d1a1a62f8f20", sha256 = "50afa2cb66bea6a0314ef28034f3ff1647325e30cf5940f97906a56fd9640bd8",
) )

View File

@ -7,6 +7,7 @@ copts_arm = [
"-DWEBRTC_NS_FLOAT", "-DWEBRTC_NS_FLOAT",
"-DWEBRTC_IOS", "-DWEBRTC_IOS",
"-DWEBRTC_HAS_NEON", "-DWEBRTC_HAS_NEON",
"-DTGVOIP_NO_DSP",
] ]
copts_x86 = [ copts_x86 = [
@ -14,52 +15,11 @@ copts_x86 = [
"-DWEBRTC_APM_DEBUG_DUMP=0", "-DWEBRTC_APM_DEBUG_DUMP=0",
"-DWEBRTC_POSIX", "-DWEBRTC_POSIX",
"-DTGVOIP_HAVE_TGLOG", "-DTGVOIP_HAVE_TGLOG",
"-DTGVOIP_NO_DSP",
"-DWEBRTC_NS_FLOAT", "-DWEBRTC_NS_FLOAT",
"-DWEBRTC_IOS", "-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( objc_library(
name = "TgVoip", name = "TgVoip",
enable_modules = True, enable_modules = True,
@ -77,9 +37,6 @@ objc_library(
"libtgvoip/os/darwin/*.mm", "libtgvoip/os/darwin/*.mm",
"libtgvoip/os/darwin/*.cpp", "libtgvoip/os/darwin/*.cpp",
"libtgvoip/os/posix/*.cpp", "libtgvoip/os/posix/*.cpp",
"libtgvoip/webrtc_dsp/**/*.c",
"libtgvoip/webrtc_dsp/**/*.cc",
"libtgvoip/webrtc_dsp/**/*.cpp",
], exclude = ["libtgvoip/os/darwin/*OSX*"]), ], exclude = ["libtgvoip/os/darwin/*OSX*"]),
hdrs = glob([ hdrs = glob([
"PublicHeaders/**/*.h", "PublicHeaders/**/*.h",
@ -87,12 +44,12 @@ objc_library(
copts = [ copts = [
"-I{}/PublicHeaders/TgVoip".format(package_name()), "-I{}/PublicHeaders/TgVoip".format(package_name()),
"-I{}/libtgvoip".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", "-Isubmodules/Opus/Public/opus",
"-DTGVOIP_USE_INSTALLED_OPUS", "-DTGVOIP_USE_INSTALLED_OPUS",
"-Drtc=rtc1", "-Drtc=rtc1",
"-Dwebrtc=webrtc1", "-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_armv7": copts_arm,
"@build_bazel_rules_apple//apple:ios_arm64": copts_arm, "@build_bazel_rules_apple//apple:ios_arm64": copts_arm,
"//build-system:ios_sim_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 _callConnectTimeout;
NSTimeInterval _callPacketTimeout; NSTimeInterval _callPacketTimeout;
TgVoip *_tgVoip; std::unique_ptr<TgVoip> _tgVoip;
OngoingCallState _state; OngoingCallState _state;
int32_t _signalBars; int32_t _signalBars;
@ -262,45 +262,32 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
endpoints.push_back(endpoint); endpoints.push_back(endpoint);
} }
TgVoipConfig config = { TgVoipConfig config;
.initializationTimeout = _callConnectTimeout, config.initializationTimeout = _callConnectTimeout;
.receiveTimeout = _callPacketTimeout, config.receiveTimeout = _callPacketTimeout;
.dataSaving = callControllerDataSavingForType(dataSaving), config.dataSaving = callControllerDataSavingForType(dataSaving);
.enableP2P = static_cast<bool>(allowP2P), config.enableP2P = static_cast<bool>(allowP2P);
.enableAEC = false, config.enableAEC = false;
.enableNS = true, config.enableNS = true;
.enableAGC = true, config.enableAGC = true;
.enableCallUpgrade = false, config.enableVolumeControl = false;
.logPath = logPath.length == 0 ? "" : std::string(logPath.UTF8String), config.enableCallUpgrade = false;
.maxApiLayer = [OngoingCallThreadLocalContext maxLayer] config.logPath = logPath.length == 0 ? "" : std::string(logPath.UTF8String);
}; config.maxApiLayer = [OngoingCallThreadLocalContext maxLayer];
std::vector<uint8_t> encryptionKeyValue; std::vector<uint8_t> encryptionKeyValue;
encryptionKeyValue.resize(key.length); encryptionKeyValue.resize(key.length);
memcpy(encryptionKeyValue.data(), key.bytes, key.length); memcpy(encryptionKeyValue.data(), key.bytes, key.length);
TgVoipEncryptionKey encryptionKey = { TgVoipEncryptionKey encryptionKey;
.value = encryptionKeyValue, encryptionKey.value = encryptionKeyValue;
.isOutgoing = isOutgoing, encryptionKey.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
*/
_tgVoip = TgVoip::makeInstance( _tgVoip = TgVoip::makeInstance(
config, config,
{ derivedStateValue }, { derivedStateValue },
endpoints, endpoints,
proxyValue, proxyValue.get(),
callControllerNetworkTypeForType(networkType), callControllerNetworkTypeForType(networkType),
encryptionKey, encryptionKey,
crypto crypto
@ -341,8 +328,7 @@ static void (*InternalVoipLoggingFunction)(NSString *) = NULL;
NSString *debugLog = [NSString stringWithUTF8String:finalState.debugLog.c_str()]; NSString *debugLog = [NSString stringWithUTF8String:finalState.debugLog.c_str()];
_lastDerivedState = [[NSData alloc] initWithBytes:finalState.persistentState.value.data() length:finalState.persistentState.value.size()]; _lastDerivedState = [[NSData alloc] initWithBytes:finalState.persistentState.value.data() length:finalState.persistentState.value.size()];
delete _tgVoip; _tgVoip.reset();
_tgVoip = NULL;
if (completion) { if (completion) {
completion(debugLog, finalState.trafficStats.bytesSentWifi, finalState.trafficStats.bytesReceivedWifi, finalState.trafficStats.bytesSentMobile, finalState.trafficStats.bytesReceivedMobile); 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 { - (void)controllerStateChanged:(TgVoipState)state {
OngoingCallState callState = OngoingCallStateInitializing; OngoingCallState callState = OngoingCallStateInitializing;
switch (state) { switch (state) {
case TgVoipState::Estabilished: case TgVoipState::Established:
callState = OngoingCallStateConnected; callState = OngoingCallStateConnected;
break; break;
case TgVoipState::Failed: case TgVoipState::Failed:

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

View File

@ -57,7 +57,7 @@ genrule(
mkdir -p "$$BUILD_DIR/Public/mozjpeg" 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([ "\n".join([
"cp -f \"$$BUILD_DIR/mozjpeg/{}\" \"$(location Public/mozjpeg/{})\"".format(header, header) for header in headers "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" pushd "$$BUILD_DIR/yasm-1.3.0"
mkdir build mkdir build
cd 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 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
arch -x86_64 make -j $$core_count make -j $$core_count
popd popd
tar -cf "$(location yasm.tar)" -C "$$BUILD_DIR/yasm-1.3.0/build" . tar -cf "$(location yasm.tar)" -C "$$BUILD_DIR/yasm-1.3.0/build" .