diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index ae1c6b5121..0f545879c8 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -23,7 +23,7 @@ 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 "webrtc/webrtc_video_track.h" #include "data/data_user.h" #include "data/data_session.h" #include "facades.h" @@ -758,17 +758,21 @@ void Call::createAndStartController(const MTPDphoneCall &call) { if (_muted.current()) { raw->setMuteMicrophone(_muted.current()); } + + _videoTrack = std::make_shared(); + _videoTrack->renderNextFrame( + ) | rpl::start_with_next([=] { + if (_remoteVideoInactiveFrom > 0 + && (_remoteVideoInactiveFrom + kDropFramesWhileInactive + > crl::now())) { + } else { + _frames.fire_copy(_videoTrack->frame(webrtc::FrameRequest())); + _videoTrack->markFrameShown(); + } + }, lifetime()); + raw->setIncomingVideoOutput(_videoTrack->sink()); + const auto &settings = Core::App().settings(); - raw->setIncomingVideoOutput(webrtc::CreateVideoSink([=](QImage frame) { - crl::on_main(weak, [=] { - if (_remoteVideoInactiveFrom > 0 - && (_remoteVideoInactiveFrom + kDropFramesWhileInactive - > crl::now())) { - } else { - _frames.fire_copy(frame); - } - }); - })); raw->setAudioOutputDevice( settings.callOutputDeviceID().toStdString()); raw->setAudioInputDevice( diff --git a/Telegram/SourceFiles/calls/calls_call.h b/Telegram/SourceFiles/calls/calls_call.h index c5b4c39e68..a794280795 100644 --- a/Telegram/SourceFiles/calls/calls_call.h +++ b/Telegram/SourceFiles/calls/calls_call.h @@ -26,6 +26,10 @@ enum class State; enum class VideoState; } // namespace tgcalls +namespace webrtc { +class VideoTrack; +} // namespace webrtc + namespace Calls { struct DhConfig { @@ -227,6 +231,7 @@ private: std::unique_ptr _instance; std::shared_ptr _videoCapture; + std::shared_ptr _videoTrack; std::unique_ptr _waitingTrack; diff --git a/Telegram/lib_webrtc b/Telegram/lib_webrtc index fa4c2e22d6..817d74d734 160000 --- a/Telegram/lib_webrtc +++ b/Telegram/lib_webrtc @@ -1 +1 @@ -Subproject commit fa4c2e22d678d7a977b5f4572689e459be29b7e3 +Subproject commit 817d74d734385fa4eb814c7f3ff0b4284b872b91