| 59 | } |
| 60 | |
| 61 | GroupCall::GroupCall( |
| 62 | not_null<PeerData*> peer, |
| 63 | CallId id, |
| 64 | uint64 accessHash, |
| 65 | TimeId scheduleDate, |
| 66 | bool rtmp, |
| 67 | GroupCallOrigin origin) |
| 68 | : _id(id) |
| 69 | , _accessHash(accessHash) |
| 70 | , _peer(peer) |
| 71 | , _reloadByQueuedUpdatesTimer([=] { reload(); }) |
| 72 | , _speakingByActiveFinishTimer([=] { checkFinishSpeakingByActive(); }) |
| 73 | , _scheduleDate(scheduleDate) |
| 74 | , _savedSendAs(peer->session().user()) |
| 75 | , _rtmp(rtmp) |
| 76 | , _conference(origin == GroupCallOrigin::Conference) |
| 77 | , _videoStream(origin == GroupCallOrigin::VideoStream) |
| 78 | , _listenersHidden(rtmp) { |
| 79 | if (_conference) { |
| 80 | session().data().registerGroupCall(this); |
| 81 | |
| 82 | _participantUpdates.events( |
| 83 | ) | rpl::filter([=](const ParticipantUpdate &update) { |
| 84 | return !update.now |
| 85 | && !update.was->peer->isSelf() |
| 86 | && !_participantsWithAccess.current().empty(); |
| 87 | }) | rpl::on_next([=](const ParticipantUpdate &update) { |
| 88 | if (const auto id = peerToUser(update.was->peer->id)) { |
| 89 | if (_participantsWithAccess.current().contains(id)) { |
| 90 | _staleParticipantIds.fire({ id }); |
| 91 | } |
| 92 | } |
| 93 | }, _checkStaleLifetime); |
| 94 | |
| 95 | _participantsWithAccess.changes( |
| 96 | ) | rpl::filter([=](const base::flat_set<UserId> &list) { |
| 97 | return !list.empty(); |
| 98 | }) | rpl::on_next([=] { |
| 99 | if (_allParticipantsLoaded) { |
| 100 | checkStaleParticipants(); |
| 101 | } else { |
| 102 | requestParticipants(); |
| 103 | } |
| 104 | }, _checkStaleLifetime); |
| 105 | } else if (_videoStream) { |
| 106 | session().data().registerGroupCall(this); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | GroupCall::~GroupCall() { |
| 111 | if (_conference || _videoStream) { |
nothing calls this directly
no test coverage detected