2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Update speaking status based on audio level.

This commit is contained in:
John Preston
2020-11-28 12:01:50 +03:00
parent b54a2aa40b
commit d1c821973a
6 changed files with 163 additions and 16 deletions

View File

@@ -105,6 +105,11 @@ bool GroupCall::participantsLoaded() const {
return _allReceived;
}
UserData *GroupCall::userBySource(uint32 source) const {
const auto i = _userBySource.find(source);
return (i != end(_userBySource)) ? i->second.get() : nullptr;
}
rpl::producer<> GroupCall::participantsSliceAdded() {
return _participantsSliceAdded.events();
}
@@ -183,6 +188,7 @@ void GroupCall::applyParticipantsSlice(
.participant = *i,
.removed = true,
};
_userBySource.erase(i->source);
_participants.erase(i);
if (sendIndividualUpdates) {
_participantUpdates.fire(std::move(update));
@@ -201,9 +207,14 @@ void GroupCall::applyParticipantsSlice(
.canSelfUnmute = !data.is_muted() || data.is_can_self_unmute(),
};
if (i == end(_participants)) {
_userBySource.emplace(value.source, value.user);
_participants.push_back(value);
++fullCount;
} else {
if (i->source != value.source) {
_userBySource.erase(i->source);
_userBySource.emplace(value.source, value.user);
}
*i = value;
}
_participantUpdates.fire({