This commit is contained in:
Isaac 2025-06-28 13:14:15 +02:00
parent 8b2bcc462c
commit 7512f7f017
16 changed files with 66 additions and 35 deletions

View File

@ -1782,10 +1782,15 @@ ios_application(
#"//submodules/Display",
#"//submodules/TelegramCore",
#"//submodules/FFMpegBinding",
"//third-party/webrtc",
"//third-party/webrtc:webrtc_objc",
#"//third-party/webrtc",
#"//third-party/webrtc:webrtc_objc",
#"//submodules/AsyncDisplayKit",
#"//submodules/ObjCRuntimeUtils",
#"//submodules/OpusBinding",
#"//third-party/boringssl:ssl",
#"//third-party/boringssl:crypto",
#"//submodules/TelegramVoip",
"//submodules/TelegramUI",
],
)

View File

@ -278,6 +278,9 @@ def _collect_spm_modules_impl(target, ctx):
if SPMModulesInfo in dep:
# Merge the modules dictionaries
for label, info in dep[SPMModulesInfo].modules.items():
if label in all_modules:
if all_modules[label]["path"] != info["path"]:
fail("Duplicate module name: {}".format(label))
all_modules[label] = info
# Add transitive sources depset from dependency to the list
dep_transitive_sources_list.append(dep[SPMModulesInfo].transitive_sources)

View File

@ -105,20 +105,21 @@ for name, module in sorted(modules.items()):
combined_lines.append(" .target(")
combined_lines.append(" name: \"%s\"," % name)
relative_module_path = module["path"] + "/Module_" + name
relative_module_path = module["path"]
module_directory = spm_files_dir + "/" + relative_module_path
os.makedirs(module_directory, exist_ok=True)
module_public_headers_prefix = ""
if len(module["includes"]) > 1:
print("{}: Multiple includes are not yet supported: {}".format(name, module["includes"]))
sys.exit(1)
elif len(module["includes"]) == 1:
for include_directory in module["includes"]:
if include_directory != ".":
#print("{}: Include directory: {}".format(name, include_directory))
module_public_headers_prefix = include_directory
break
if module_type == "objc_library" or module_type == "cc_library":
if len(module["includes"]) > 1:
print("{}: Multiple includes are not yet supported: {}".format(name, module["includes"]))
sys.exit(1)
elif len(module["includes"]) == 1:
for include_directory in module["includes"]:
if include_directory != ".":
#print("{}: Include directory: {}".format(name, include_directory))
module_public_headers_prefix = include_directory
break
combined_lines.append(" dependencies: [")
for dep in module["deps"]:
@ -181,13 +182,18 @@ for name, module in sorted(modules.items()):
sys.exit(1)
module_to_source_files[name] = include_source_files
if True:
combined_lines.append(f" sources: sourceFileMap[\"{name}\"]!,")
else:
combined_lines.append(" sources: [")
for include_source_file in include_source_files:
combined_lines.append(" \"%s\"," % (include_source_file))
ignore_sub_folders = []
for other_name, other_module in sorted(modules.items()):
if other_module["path"] != module["path"] and other_module["path"].startswith(module["path"] + "/"):
exclude_path = other_module["path"][len(module["path"]) + 1:]
ignore_sub_folders.append(exclude_path)
if len(ignore_sub_folders) != 0:
combined_lines.append(" exclude: [")
for sub_folder in ignore_sub_folders:
combined_lines.append(f" \"{sub_folder}\",")
combined_lines.append(" ],")
combined_lines.append(f" sources: sourceFileMap[\"{name}\"]!,")
modulemap_path = os.path.join(os.path.join(os.path.join(module_directory), module_public_headers_prefix), "module.modulemap")
if modulemap_path not in modulemaps:
@ -223,27 +229,18 @@ for name, module in sorted(modules.items()):
combined_lines.append(" .unsafeFlags([")
for flag in copts:
escaped_flag = escape_swift_string_literal_component(flag)
if escaped_flag.startswith("-I"):
if escaped_flag.startswith("-I") and False:
include_path = escaped_flag[2:]
#print("{}: Include path: {}".format(name, include_path))
found_reference = False
for another_module_name, another_module in sorted(modules.items()):
another_module_path = another_module["path"]
if include_path.startswith(another_module_path):
relative_module_include_path = include_path[len(another_module_path) + 1:]
#print(" {}: Matches module: {}".format(another_module_name, another_module_path))
matched_public_include = False
if len(relative_module_include_path) == 0:
combined_lines.append(f' "-I{another_module_path}/Module_{another_module_name}",')
else:
combined_lines.append(f' "-I{another_module_path}/Module_{another_module_name}/{relative_module_include_path}",')
combined_lines.append(f' "-I{include_path}",')
found_reference = True
if not found_reference:
print(f"{name}: Unresolved include path: {include_path}")
sys.exit(1)
else:
combined_lines.append(f' "{escaped_flag}",')
combined_lines.append(" ]),")

View File

@ -3,9 +3,12 @@
#import <CommonCrypto/CommonCrypto.h>
NSData * _Nonnull CryptoMD5(const void * _Nonnull bytes, int count) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSMutableData *result = [[NSMutableData alloc] initWithLength:(NSUInteger)CC_MD5_DIGEST_LENGTH];
CC_MD5(bytes, (CC_LONG)count, result.mutableBytes);
return result;
#pragma clang diagnostic pop
}
NSData * _Nonnull CryptoSHA1(const void * _Nonnull bytes, int count) {
@ -32,6 +35,9 @@ NSData * _Nonnull CryptoSHA512(const void * _Nonnull bytes, int count) {
@end
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@implementation IncrementalMD5
- (instancetype _Nonnull)init {
@ -56,6 +62,8 @@ NSData * _Nonnull CryptoSHA512(const void * _Nonnull bytes, int count) {
return result;
}
#pragma clang diagnostic pop
@end
NSData * _Nullable CryptoAES(bool encrypt, NSData * _Nonnull key, NSData * _Nonnull iv, NSData * _Nonnull data) {

View File

@ -3,7 +3,7 @@ import Postbox
import SwiftSignalKit
import TelegramApi
import MtProtoKit
import EncryptionProvider
struct SecretChatRequestData {
let g: Int32

View File

@ -3,6 +3,7 @@ import Postbox
import SwiftSignalKit
import TelegramApi
import MtProtoKit
import EncryptionProvider
private func reactionGeneratedEvent(_ previousReactions: ReactionsMessageAttribute?, _ updatedReactions: ReactionsMessageAttribute?, message: Message, transaction: Transaction) -> (reactionAuthor: Peer, reaction: MessageReaction.Reaction, message: Message, timestamp: Int32)? {
if let updatedReactions = updatedReactions, !message.flags.contains(.Incoming), message.id.peerId.namespace == Namespaces.Peer.CloudUser {

View File

@ -2,6 +2,7 @@ import Postbox
import SwiftSignalKit
import TelegramApi
import MtProtoKit
import Foundation
public final class TelegramKeyPair: Equatable {
public let id: Int64

View File

@ -2,6 +2,7 @@ import SwiftSignalKit
import Postbox
import TelegramApi
import MtProtoKit
import Foundation
public struct EngineCallStreamState {
public struct Channel {

View File

@ -1,6 +1,7 @@
import Postbox
import TelegramApi
import MtProtoKit
import Foundation
public func smallestVideoRepresentation(_ representations: [TelegramMediaImage.VideoRepresentation]) -> TelegramMediaImage.VideoRepresentation? {
if representations.count == 0 {

View File

@ -2,6 +2,7 @@ import Foundation
import SwiftSignalKit
import TgVoipWebrtc
import TelegramCore
import CoreMedia
#if os(macOS)
public class OngoingCallContext {

View File

@ -3,6 +3,7 @@ import SwiftSignalKit
import TelegramCore
import Network
import TelegramUIPreferences
import CoreMedia
import TgVoipWebrtc

View File

@ -125,8 +125,6 @@ sources = glob([
"tgcalls/tgcalls/v2/SignalingConnection.cpp",
"tgcalls/tgcalls/v2/SignalingEncryption.cpp",
"tgcalls/tgcalls/v2/SignalingSctpConnection.cpp",
"tgcalls/tgcalls/v2/SignalingKcpConnection.cpp",
"tgcalls/tgcalls/v2/ikcp.cpp",
]
objc_library(
@ -155,6 +153,7 @@ objc_library(
"-DRTC_ENABLE_VP9",
"-DTGVOIP_NAMESPACE=tgvoip_webrtc",
"-std=c++17",
"-Werror",
] + optimization_flags,
includes = [
"PublicHeaders",

View File

@ -71,6 +71,10 @@
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
# include <sys/types.h>
# include <_types/_uint16_t.h>
# include <_types/_uint32_t.h>
# include <_types/_uint64_t.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;

View File

@ -102,7 +102,10 @@ void compute_dense(const DenseLayer *layer, float *output, const float *input)
for (i=0;i<N;i++)
output[i] = relu(output[i]);
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnull-dereference"
*(int*)0=0;
#pragma clang diagnostic pop
}
}
@ -148,7 +151,12 @@ void compute_gru(const GRULayer *gru, float *state, const float *input)
if (gru->activation == ACTIVATION_SIGMOID) sum = sigmoid_approx(WEIGHTS_SCALE*sum);
else if (gru->activation == ACTIVATION_TANH) sum = tansig_approx(WEIGHTS_SCALE*sum);
else if (gru->activation == ACTIVATION_RELU) sum = relu(WEIGHTS_SCALE*sum);
else *(int*)0=0;
else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnull-dereference"
*(int*)0=0;
#pragma clang diagnostic pop
}
h[i] = z[i]*state[i] + (1-z[i])*sum;
}
for (i=0;i<N;i++)

View File

@ -3127,6 +3127,7 @@ objc_library(
"-Wno-all",
"-Ithird-party/webrtc/libsrtp/third_party/libsrtp/include",
"-Ithird-party/webrtc/libsrtp/third_party/libsrtp/crypto/include",
"-Ithird-party/webrtc/libsrtp",
"-Ithird-party/webrtc/webrtc/",
"-Ithird-party/libyuv",
"-Ithird-party/webrtc/absl",
@ -3163,7 +3164,7 @@ objc_library(
":field_trials_header",
"//third-party/webrtc/crc32c",
"//third-party/webrtc/libsrtp_config",
"//third-party/webrtc/rnnoise",
"//third-party/webrtc/rnnoise:webrtc_rnnoise",
"//third-party/webrtc/pffft",
"//third-party/webrtc/libsrtp",
"//third-party/webrtc/absl",

View File

@ -1,6 +1,6 @@
cc_library(
name = "rnnoise",
name = "webrtc_rnnoise",
hdrs = [
"third_party/rnnoise/src/rnn_vad_weights.h",
"third_party/rnnoise/src/rnn_activations.h",