mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-25 02:32:52 +02:00
Correctly handle 'min' group call participant updates.
This commit is contained in:
parent
5feb381cb2
commit
4e5c81dac2
4 changed files with 22 additions and 7 deletions
|
@ -1196,7 +1196,7 @@ groupCall#55903081 flags:# join_muted:flags.1?true can_change_join_muted:flags.2
|
|||
|
||||
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
|
||||
|
||||
groupCallParticipant#64c62a15 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true muted_by_you:flags.9?true user_id:int date:int active_date:flags.3?int source:int volume:flags.7?int = GroupCallParticipant;
|
||||
groupCallParticipant#64c62a15 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true user_id:int date:int active_date:flags.3?int source:int volume:flags.7?int = GroupCallParticipant;
|
||||
|
||||
phone.groupCall#66ab0bfc call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string users:Vector<User> = phone.GroupCall;
|
||||
|
||||
|
|
|
@ -595,6 +595,10 @@ void GroupCall::handleUpdate(const MTPDupdateGroupCallParticipants &data) {
|
|||
|
||||
const auto handleOtherParticipants = [=](
|
||||
const MTPDgroupCallParticipant &data) {
|
||||
if (data.is_min()) {
|
||||
// No real information about mutedByMe or my custom volume.
|
||||
return;
|
||||
}
|
||||
const auto user = _peer->owner().user(data.vuser_id().v);
|
||||
const auto participant = LookupParticipant(_peer, _id, user);
|
||||
if (!participant) {
|
||||
|
|
|
@ -276,17 +276,25 @@ void GroupCall::applyParticipantsSlice(
|
|||
&& ((was ? was->speaking : false)
|
||||
|| (!amInCall
|
||||
&& (lastActive + speakingAfterActive > now)));
|
||||
const auto defaultVolume = Calls::Group::kDefaultVolume;
|
||||
const auto volume = (was && data.is_min())
|
||||
? was->volume
|
||||
: data.vvolume().value_or(Calls::Group::kDefaultVolume);
|
||||
const auto mutedByMe = (was && data.is_min())
|
||||
? was->mutedByMe
|
||||
: data.is_muted_by_you();
|
||||
const auto onlyMinLoaded = data.is_min()
|
||||
&& (!was || was->onlyMinLoaded);
|
||||
const auto value = Participant{
|
||||
.user = user,
|
||||
.date = data.vdate().v,
|
||||
.lastActive = lastActive,
|
||||
.ssrc = uint32(data.vsource().v),
|
||||
.volume = data.vvolume().value_or(defaultVolume),
|
||||
.volume = volume,
|
||||
.speaking = canSelfUnmute && (was ? was->speaking : false),
|
||||
.muted = data.is_muted(),
|
||||
.mutedByMe = data.is_muted_by_you(),
|
||||
.mutedByMe = mutedByMe,
|
||||
.canSelfUnmute = canSelfUnmute,
|
||||
.onlyMinLoaded = onlyMinLoaded,
|
||||
};
|
||||
if (i == end(_participants)) {
|
||||
_userBySsrc.emplace(value.ssrc, user);
|
||||
|
@ -358,11 +366,13 @@ void GroupCall::applyActiveUpdate(
|
|||
not_null{ userLoaded },
|
||||
&Participant::user)
|
||||
: _participants.end();
|
||||
if (i == end(_participants)) {
|
||||
const auto notFound = (i == end(_participants));
|
||||
const auto loadByUserId = notFound || i->onlyMinLoaded;
|
||||
if (loadByUserId) {
|
||||
_unknownSpokenUids[userId] = when;
|
||||
requestUnknownParticipants();
|
||||
return;
|
||||
} else if (!i->canSelfUnmute) {
|
||||
}
|
||||
if (notFound || !i->canSelfUnmute) {
|
||||
return;
|
||||
}
|
||||
const auto was = std::make_optional(*i);
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
bool muted = false;
|
||||
bool mutedByMe = false;
|
||||
bool canSelfUnmute = false;
|
||||
bool onlyMinLoaded = false;
|
||||
};
|
||||
struct ParticipantUpdate {
|
||||
std::optional<Participant> was;
|
||||
|
|
Loading…
Add table
Reference in a new issue