mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Update API scheme on layer 202.
This commit is contained in:
parent
502045f1fa
commit
a5fa595627
8 changed files with 51 additions and 13 deletions
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "calls/group/calls_group_call.h"
|
||||
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "api/api_send_progress.h"
|
||||
#include "api/api_updates.h"
|
||||
|
@ -756,7 +757,7 @@ void GroupCall::setupConferenceCall() {
|
|||
|
||||
_conferenceCall->staleParticipantIds(
|
||||
) | rpl::start_with_next([=](const base::flat_set<UserId> &staleIds) {
|
||||
removeConferenceParticipants(staleIds);
|
||||
removeConferenceParticipants(staleIds, true);
|
||||
}, _lifetime);
|
||||
_e2e->participantsSetValue(
|
||||
) | rpl::start_with_next([=](const TdE2E::ParticipantsSet &set) {
|
||||
|
@ -775,7 +776,8 @@ void GroupCall::setupConferenceCall() {
|
|||
}
|
||||
|
||||
void GroupCall::removeConferenceParticipants(
|
||||
const base::flat_set<UserId> userIds) {
|
||||
const base::flat_set<UserId> userIds,
|
||||
bool removingStale) {
|
||||
Expects(_e2e != nullptr);
|
||||
Expects(!userIds.empty());
|
||||
|
||||
|
@ -791,7 +793,9 @@ void GroupCall::removeConferenceParticipants(
|
|||
if (block.data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
using Flag = MTPphone_DeleteConferenceCallParticipants::Flag;
|
||||
_api.request(MTPphone_DeleteConferenceCallParticipants(
|
||||
MTP_flags(removingStale ? Flag::f_only_left : Flag::f_kick),
|
||||
inputCall(),
|
||||
MTP_vector<MTPlong>(std::move(inputs)),
|
||||
MTP_bytes(block.data)
|
||||
|
@ -2722,6 +2726,15 @@ void GroupCall::toggleRecording(
|
|||
}).send();
|
||||
}
|
||||
|
||||
auto GroupCall::lookupVideoCodecPreferences() const
|
||||
-> std::vector<tgcalls::VideoCodecName> {
|
||||
auto result = std::vector<tgcalls::VideoCodecName>();
|
||||
if (_peer->session().appConfig().confcallPrioritizeVP8()) {
|
||||
result.push_back(tgcalls::VideoCodecName::VP8);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GroupCall::tryCreateController() {
|
||||
if (_instance) {
|
||||
return false;
|
||||
|
@ -2828,6 +2841,7 @@ bool GroupCall::tryCreateController() {
|
|||
.videoContentType = tgcalls::VideoContentType::Generic,
|
||||
.initialEnableNoiseSuppression
|
||||
= settings.groupCallNoiseSuppression(),
|
||||
.videoCodecPreferences = lookupVideoCodecPreferences(),
|
||||
.requestMediaChannelDescriptions = [=, call = base::make_weak(this)](
|
||||
const std::vector<uint32_t> &ssrcs,
|
||||
std::function<void(
|
||||
|
@ -2893,6 +2907,7 @@ bool GroupCall::tryCreateScreencast() {
|
|||
.createAudioDeviceModule = Webrtc::LoopbackAudioDeviceModuleCreator(),
|
||||
.videoCapture = _screenCapture,
|
||||
.videoContentType = tgcalls::VideoContentType::Screencast,
|
||||
.videoCodecPreferences = lookupVideoCodecPreferences(),
|
||||
.e2eEncryptDecrypt = _e2e ? _e2e->callbackEncryptDecrypt() : nullptr,
|
||||
};
|
||||
|
||||
|
@ -3023,6 +3038,7 @@ bool GroupCall::mediaChannelDescriptionsFill(
|
|||
add(Channel{
|
||||
.type = Channel::Type::Audio,
|
||||
.audioSsrc = ssrc,
|
||||
.userId = int64_t(peerToUser(byAudio->id).bare),
|
||||
});
|
||||
} else if (!resolved) {
|
||||
_unresolvedSsrcs.emplace(ssrc);
|
||||
|
@ -3155,6 +3171,7 @@ void GroupCall::updateRequestedVideoChannels() {
|
|||
}
|
||||
channels.push_back({
|
||||
.audioSsrc = participant->ssrc,
|
||||
.userId = int64_t(peerToUser(participant->peer->id).bare),
|
||||
.endpointId = endpointId,
|
||||
.ssrcGroups = (params->camera.endpointId == endpointId
|
||||
? params->camera.ssrcGroups
|
||||
|
|
|
@ -23,6 +23,7 @@ struct GroupLevelsUpdate;
|
|||
struct GroupNetworkState;
|
||||
struct GroupParticipantDescription;
|
||||
class VideoCaptureInterface;
|
||||
enum class VideoCodecName;
|
||||
} // namespace tgcalls
|
||||
|
||||
namespace base {
|
||||
|
@ -285,7 +286,9 @@ public:
|
|||
void startScheduledNow();
|
||||
void toggleScheduleStartSubscribed(bool subscribed);
|
||||
void setNoiseSuppression(bool enabled);
|
||||
void removeConferenceParticipants(const base::flat_set<UserId> userIds);
|
||||
void removeConferenceParticipants(
|
||||
const base::flat_set<UserId> userIds,
|
||||
bool removingStale = false);
|
||||
|
||||
bool emitShareScreenError();
|
||||
bool emitShareCameraError();
|
||||
|
@ -533,6 +536,8 @@ private:
|
|||
int subchain,
|
||||
const QVector<MTPbytes> &blocks,
|
||||
int next);
|
||||
[[nodiscard]] auto lookupVideoCodecPreferences() const
|
||||
-> std::vector<tgcalls::VideoCodecName>;
|
||||
bool tryCreateController();
|
||||
void destroyController();
|
||||
bool tryCreateScreencast();
|
||||
|
|
|
@ -108,6 +108,11 @@ int AppConfig::pinnedGiftsLimit() const {
|
|||
return get<int>(u"stargifts_pinned_to_top_limit"_q, 6);
|
||||
}
|
||||
|
||||
bool AppConfig::confcallPrioritizeVP8() const {
|
||||
AssertIsDebug();
|
||||
return true;
|
||||
}
|
||||
|
||||
void AppConfig::refresh(bool force) {
|
||||
if (_requestId || !_api) {
|
||||
if (force) {
|
||||
|
|
|
@ -79,6 +79,8 @@ public:
|
|||
|
||||
[[nodiscard]] int pinnedGiftsLimit() const;
|
||||
|
||||
[[nodiscard]] bool confcallPrioritizeVP8() const;
|
||||
|
||||
void refresh(bool force = false);
|
||||
|
||||
private:
|
||||
|
|
|
@ -961,7 +961,7 @@ phoneCallEmpty#5366c915 id:long = PhoneCall;
|
|||
phoneCallWaiting#c5226f17 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long protocol:PhoneCallProtocol receive_date:flags.0?int = PhoneCall;
|
||||
phoneCallRequested#14b0ed0c flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_hash:bytes protocol:PhoneCallProtocol = PhoneCall;
|
||||
phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_b:bytes protocol:PhoneCallProtocol = PhoneCall;
|
||||
phoneCall#30535af5 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON = PhoneCall;
|
||||
phoneCall#30535af5 flags:# p2p_allowed:flags.5?true video:flags.6?true conference_supported:flags.8?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int custom_parameters:flags.7?DataJSON = PhoneCall;
|
||||
phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
|
||||
|
||||
phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
|
||||
|
@ -2609,7 +2609,7 @@ phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallS
|
|||
phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl;
|
||||
phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool;
|
||||
phone.createConferenceCall#fbcefee6 random_id:int = phone.GroupCall;
|
||||
phone.deleteConferenceCallParticipants#f9231114 call:InputGroupCall ids:Vector<long> block:bytes = Updates;
|
||||
phone.deleteConferenceCallParticipants#8ca60525 flags:# only_left:flags.0?true kick:flags.1?true call:InputGroupCall ids:Vector<long> block:bytes = Updates;
|
||||
phone.sendConferenceCallBroadcast#c6701900 call:InputGroupCall block:bytes = Updates;
|
||||
phone.inviteConferenceCallParticipant#bcf22685 flags:# video:flags.0?true call:InputGroupCall user_id:InputUser = Updates;
|
||||
phone.declineConferenceCallInvite#3c479971 msg_id:int = Updates;
|
||||
|
|
|
@ -239,6 +239,7 @@ void Call::apply(int subchain, const Block &last) {
|
|||
}
|
||||
LOG_APPLY(-1, Slice(last.data));
|
||||
const auto id = tde2e_api::call_create(
|
||||
std::int64_t(_myUserId.v),
|
||||
std::int64_t(_myKeyId.v),
|
||||
Slice(last.data));
|
||||
if (!id.is_ok()) {
|
||||
|
@ -446,7 +447,7 @@ rpl::producer<QByteArray> Call::emojiHashValue() const {
|
|||
}
|
||||
|
||||
auto Call::callbackEncryptDecrypt()
|
||||
-> Fn<std::vector<uint8_t>(const std::vector<uint8_t>&, bool)> {
|
||||
-> Fn<std::vector<uint8_t>(const std::vector<uint8_t>&, int64_t, bool)> {
|
||||
if (!_guardedId) {
|
||||
_guardedId = std::make_shared<GuardedCallId>();
|
||||
if (const auto raw = _id ? _guardedId.get() : nullptr) {
|
||||
|
@ -454,15 +455,20 @@ auto Call::callbackEncryptDecrypt()
|
|||
raw->exists = true;
|
||||
}
|
||||
}
|
||||
return [v = _guardedId](const std::vector<uint8_t> &data, bool encrypt) {
|
||||
if (!v->exists) {
|
||||
return [id = _guardedId](
|
||||
const std::vector<uint8_t> &data,
|
||||
int64_t userId,
|
||||
bool encrypt) {
|
||||
const auto raw = id.get();
|
||||
if (!raw->exists) {
|
||||
return std::vector<uint8_t>();
|
||||
}
|
||||
const auto libId = std::int64_t(v->value.v);
|
||||
const auto libId = std::int64_t(raw->value.v);
|
||||
const auto channelId = tde2e_api::CallChannelId(0);
|
||||
const auto slice = Slice(data);
|
||||
const auto result = encrypt
|
||||
? tde2e_api::call_encrypt(libId, slice)
|
||||
: tde2e_api::call_decrypt(libId, slice);
|
||||
? tde2e_api::call_encrypt(libId, channelId, slice)
|
||||
: tde2e_api::call_decrypt(libId, userId, channelId, slice);
|
||||
if (!result.is_ok()) {
|
||||
return std::vector<uint8_t>();
|
||||
}
|
||||
|
|
|
@ -102,7 +102,10 @@ public:
|
|||
[[nodiscard]] rpl::producer<ParticipantsSet> participantsSetValue() const;
|
||||
|
||||
[[nodiscard]] auto callbackEncryptDecrypt()
|
||||
-> Fn<std::vector<uint8_t>(const std::vector<uint8_t>&, bool)>;
|
||||
-> Fn<std::vector<uint8_t>(
|
||||
const std::vector<uint8_t>&,
|
||||
int64_t,
|
||||
bool)>;
|
||||
|
||||
private:
|
||||
static constexpr int kSubChainsCount = 2;
|
||||
|
|
2
Telegram/ThirdParty/tgcalls
vendored
2
Telegram/ThirdParty/tgcalls
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 4c2c1104b2c9a13651f4290512daf5bb2e42ac50
|
||||
Subproject commit fd1cfbd8151b2c32d5471a4f5431faa6274ce421
|
Loading…
Add table
Reference in a new issue