From 042f51e58fa6bbf89eef9cf041811ed6827b7630 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 10 Apr 2025 09:33:04 +0400 Subject: [PATCH] Optimize confcall join process. --- Telegram/SourceFiles/calls/group/calls_group_call.cpp | 5 +++++ Telegram/SourceFiles/data/data_group_call.cpp | 4 ++++ Telegram/SourceFiles/data/data_group_call.h | 1 + Telegram/SourceFiles/tde2e/tde2e_api.cpp | 4 ++++ Telegram/SourceFiles/tde2e/tde2e_api.h | 1 + Telegram/ThirdParty/tgcalls | 2 +- 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 56d690b771..68bf1aa85e 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -1554,6 +1554,11 @@ void GroupCall::rejoin(not_null as) { ).arg(_joinState.payload.ssrc)); if (!_conferenceCall && _migratedConferenceInfo) { startConference(); + } else if (_conferenceCall + && !_conferenceCall->blockchainMayBeEmpty() + && !_e2e->hasLastBlock0()) { + //sendJoinRequest(); AssertIsDebug(); + refreshLastBlockAndJoin(); } else { sendJoinRequest(); } diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index 05ee4bc787..f17e64aeb7 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -135,6 +135,10 @@ bool GroupCall::listenersHidden() const { return _listenersHidden; } +bool GroupCall::blockchainMayBeEmpty() const { + return _version < 2; +} + not_null GroupCall::peer() const { return _peer; } diff --git a/Telegram/SourceFiles/data/data_group_call.h b/Telegram/SourceFiles/data/data_group_call.h index 20c5b08f8a..ef2cf38b7b 100644 --- a/Telegram/SourceFiles/data/data_group_call.h +++ b/Telegram/SourceFiles/data/data_group_call.h @@ -78,6 +78,7 @@ public: [[nodiscard]] bool rtmp() const; [[nodiscard]] bool canManage() const; [[nodiscard]] bool listenersHidden() const; + [[nodiscard]] bool blockchainMayBeEmpty() const; [[nodiscard]] not_null peer() const; [[nodiscard]] MTPInputGroupCall input() const; [[nodiscard]] QString title() const { diff --git a/Telegram/SourceFiles/tde2e/tde2e_api.cpp b/Telegram/SourceFiles/tde2e/tde2e_api.cpp index 8827677618..e0a28936db 100644 --- a/Telegram/SourceFiles/tde2e/tde2e_api.cpp +++ b/Telegram/SourceFiles/tde2e/tde2e_api.cpp @@ -102,6 +102,10 @@ PublicKey Call::myKey() const { return _myKey; } +bool Call::hasLastBlock0() const { + return _lastBlock0.has_value(); +} + void Call::refreshLastBlock0(std::optional block) { _lastBlock0 = std::move(block); } diff --git a/Telegram/SourceFiles/tde2e/tde2e_api.h b/Telegram/SourceFiles/tde2e/tde2e_api.h index 53d8cdb61f..1af99b309f 100644 --- a/Telegram/SourceFiles/tde2e/tde2e_api.h +++ b/Telegram/SourceFiles/tde2e/tde2e_api.h @@ -95,6 +95,7 @@ public: [[nodiscard]] QByteArray emojiHash() const; [[nodiscard]] rpl::producer emojiHashValue() const; + [[nodiscard]] bool hasLastBlock0() const; void refreshLastBlock0(std::optional block); [[nodiscard]] Block makeJoinBlock(); [[nodiscard]] Block makeRemoveBlock(const base::flat_set &ids); diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index fd1cfbd815..7f04d5360f 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit fd1cfbd8151b2c32d5471a4f5431faa6274ce421 +Subproject commit 7f04d5360f3208d032dffdf634c8ff9c508da2f1