From 815300bffc3fa62a8d0971be7d61188e1bfaff3e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Jul 2020 17:55:46 +0400 Subject: [PATCH] Fix video between tdesktop instances. --- Telegram/SourceFiles/calls/calls_call.cpp | 11 +++++++++-- Telegram/ThirdParty/tgcalls | 2 +- Telegram/cmake/lib_tgcalls.cmake | 4 ++-- Telegram/cmake/lib_tgvoip.cmake | 10 +--------- Telegram/lib_webrtc | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 7746ab533..9a9070ee3 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -23,11 +23,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/audio/media_audio_track.h" #include "base/platform/base_platform_info.h" #include "calls/calls_panel.h" +#include "webrtc/webrtc_video_sink.h" #include "data/data_user.h" #include "data/data_session.h" #include "facades.h" -#include "tgcalls/Instance.h" +#include namespace tgcalls { class InstanceImpl; @@ -706,6 +707,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) { return static_cast(byte); }) | ranges::to_vector; + descriptor.videoCapture = tgcalls::CreateVideoCapture(); + const auto version = call.vprotocol().match([&]( const MTPDphoneCallProtocol &data) { return data.vlibrary_versions().v; @@ -729,7 +732,11 @@ void Call::createAndStartController(const MTPDphoneCall &call) { raw->setMuteMicrophone(_mute); } const auto &settings = Core::App().settings(); - //raw->setIncomingVideoOutput(std::make_shared>()) + raw->setIncomingVideoOutput(webrtc::CreateVideoSink([=](QImage frame) { + crl::on_main(weak, [=] { + _frames.fire_copy(frame); + }); + })); raw->setAudioOutputDevice( settings.callOutputDeviceID().toStdString()); raw->setAudioInputDevice( diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index ccba25880..f7b3ad47d 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit ccba258805478783804cf273ff8c5edffd9f009a +Subproject commit f7b3ad47df96bacf50bd958065d4d7d2901d9cfb diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake index 3b6fc933d..50e7490d6 100644 --- a/Telegram/cmake/lib_tgcalls.cmake +++ b/Telegram/cmake/lib_tgcalls.cmake @@ -5,7 +5,7 @@ # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL add_library(lib_tgcalls STATIC) -init_target(lib_tgcalls) +init_target(lib_tgcalls cxx_std_14) add_library(tdesktop::lib_tgcalls ALIAS lib_tgcalls) set(tgcalls_dir ${third_party_loc}/tgcalls) @@ -80,7 +80,7 @@ PRIVATE ) add_library(lib_tgcalls_legacy STATIC) -init_target(lib_tgcalls_legacy) +init_target(lib_tgcalls_legacy cxx_std_14) add_library(tdesktop::lib_tgcalls_legacy ALIAS lib_tgcalls_legacy) nice_target_sources(lib_tgcalls_legacy ${tgcalls_loc} diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake index 27e74d07a..a5b1d0495 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake @@ -14,17 +14,9 @@ if (TDESKTOP_USE_PACKAGED_TGVOIP AND NOT DESKTOP_APP_USE_PACKAGED_LAZY) target_link_libraries(lib_tgvoip INTERFACE PkgConfig::TGVOIP) else() add_library(lib_tgvoip STATIC) - init_target(lib_tgvoip) + init_target(lib_tgvoip cxx_std_14) add_library(tdesktop::lib_tgvoip ALIAS lib_tgvoip) - if (NOT APPLE) - # On macOS if you build libtgvoip with C++17 it uses std::optional - # instead of absl::optional and when it uses optional::value, the - # build fails, because optional::value is available starting with - # macOS 10.14+. This way we force using absl::optional. - target_compile_features(lib_tgvoip PUBLIC cxx_std_17) - endif() - set(tgvoip_loc ${third_party_loc}/libtgvoip) nice_target_sources(lib_tgvoip ${tgvoip_loc} diff --git a/Telegram/lib_webrtc b/Telegram/lib_webrtc index d3d96130b..078f6bf15 160000 --- a/Telegram/lib_webrtc +++ b/Telegram/lib_webrtc @@ -1 +1 @@ -Subproject commit d3d96130ba245e985c79c9040459b548416efdf8 +Subproject commit 078f6bf15d60c23f9907d91398bfd6bf201638be