From d9aa6602533416dc61566ae3eadd2fbc55eafbfc Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 30 Apr 2021 20:15:39 +0400 Subject: [PATCH] Handle members slice loaded. --- .../calls/group/calls_group_call.cpp | 19 +++++++++++++++++++ .../calls/group/calls_group_members.cpp | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index cdc22d9e4c..ae1cddad0a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -501,6 +501,25 @@ void GroupCall::subscribeToReal(not_null real) { const auto emptyEndpoint = std::string(); + real->participantsSliceAdded( + ) | rpl::start_with_next([=] { + const auto &participants = real->participants(); + for (const auto &participant : participants) { + const auto camera = participant.cameraEndpoint(); + const auto screen = participant.screenEndpoint(); + if (!camera.empty() + && _activeVideoEndpoints.emplace(camera).second + && _incomingVideoEndpoints.contains(camera)) { + _streamsVideoUpdated.fire({ camera, true }); + } + if (!screen.empty() + && _activeVideoEndpoints.emplace(screen).second + && _incomingVideoEndpoints.contains(screen)) { + _streamsVideoUpdated.fire({ screen, true }); + } + } + }, _lifetime); + using Update = Data::GroupCall::ParticipantUpdate; real->participantUpdated( ) | rpl::start_with_next([=](const Update &data) { diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index 59c1fe66c3..c1b766da84 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -1175,8 +1175,8 @@ void MembersController::setupListChangeViewers() { } _largeEndpoint = largeEndpoint; if (const auto participant = findParticipant(_largeEndpoint)) { - if (participant->cameraEndpoint() == _largeEndpoint) { - if (const auto row = findRow(participant->peer)) { + if (const auto row = findRow(participant->peer)) { + if (row->videoTrackEndpoint() == _largeEndpoint) { row->clearVideoTrack(); } }