From 78c9c1e7f8de279be30f4ddaf419e9fa5be2e065 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 14 Jul 2020 21:45:34 +0400 Subject: [PATCH] Update tgcalls library. --- Telegram/SourceFiles/calls/calls_call.cpp | 27 ++++++++++++----------- Telegram/SourceFiles/calls/calls_call.h | 3 ++- Telegram/ThirdParty/tgcalls | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 1615bb4b2..d8f0d23c6 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -628,6 +628,12 @@ void Call::createAndStartController(const MTPDphoneCall &call) { const auto &protocol = call.vprotocol().c_phoneCallProtocol(); const auto &serverConfig = _user->session().serverConfig(); + auto encryptionKeyValue = ranges::view::all( + _authKey + ) | ranges::view::transform([](bytes::type byte) { + return static_cast(byte); + }) | ranges::to_vector; + const auto weak = base::make_weak(this); auto descriptor = tgcalls::Descriptor{ .config = tgcalls::Config{ @@ -641,14 +647,14 @@ void Call::createAndStartController(const MTPDphoneCall &call) { .enableVolumeControl = true, .maxApiLayer = protocol.vmax_layer().v, }, + .encryptionKey = tgcalls::EncryptionKey( + std::move(encryptionKeyValue), + (_type == Type::Outgoing)), .videoCapture = nullptr, - .stateUpdated = [=](tgcalls::State state) { + .stateUpdated = [=](tgcalls::State state, tgcalls::VideoState videoState) { crl::on_main(weak, [=] { - handleControllerStateChange(state); + handleControllerStateChange(state, videoState); }); - }, - .videoStateUpdated = [=](bool state) { - }, .signalBarsUpdated = [=](int count) { crl::on_main(weak, [=] { @@ -700,13 +706,6 @@ void Call::createAndStartController(const MTPDphoneCall &call) { } } - descriptor.encryptionKey.isOutgoing = (_type == Type::Outgoing); - descriptor.encryptionKey.value = ranges::view::all( - _authKey - ) | ranges::view::transform([](bytes::type byte) { - return static_cast(byte); - }) | ranges::to_vector; - descriptor.videoCapture = tgcalls::CreateVideoCapture(); const auto version = call.vprotocol().match([&]( @@ -746,7 +745,9 @@ void Call::createAndStartController(const MTPDphoneCall &call) { raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled()); } -void Call::handleControllerStateChange(tgcalls::State state) { +void Call::handleControllerStateChange( + tgcalls::State state, + tgcalls::VideoState videoState) { switch (state) { case tgcalls::State::WaitInit: { DEBUG_LOG(("Call Info: State changed to WaitingInit.")); diff --git a/Telegram/SourceFiles/calls/calls_call.h b/Telegram/SourceFiles/calls/calls_call.h index eb2eb8328..343a20a32 100644 --- a/Telegram/SourceFiles/calls/calls_call.h +++ b/Telegram/SourceFiles/calls/calls_call.h @@ -22,6 +22,7 @@ class Track; namespace tgcalls { class Instance; enum class State; +enum class VideoState; } // namespace tgcalls namespace Calls { @@ -154,7 +155,7 @@ private: void displayNextFrame(QImage frame); void generateModExpFirst(bytes::const_span randomSeed); - void handleControllerStateChange(tgcalls::State state); + void handleControllerStateChange(tgcalls::State state, tgcalls::VideoState videoState); void handleControllerBarCountChange(int count); void createAndStartController(const MTPDphoneCall &call); diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index 36566eda2..80c2b48f3 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit 36566eda283ae3731ff2911965ee09efbf9ae361 +Subproject commit 80c2b48f30b9ee21b75abf2afda09c5fc77b4145