Fix updating of volume_level by min-updates.

This commit is contained in:
levlam 2021-02-01 22:29:45 +03:00
parent e3cb608293
commit dfdc08162e
5 changed files with 11 additions and 1 deletions

View File

@ -1183,7 +1183,7 @@ groupCall#55903081 flags:# join_muted:flags.1?true can_change_join_muted:flags.2
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall; 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 volume_by_admin:flags.10?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; phone.groupCall#66ab0bfc call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string users:Vector<User> = phone.GroupCall;

Binary file not shown.

View File

@ -1366,6 +1366,11 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
} }
participant.is_just_joined = false; participant.is_just_joined = false;
update_group_call_participant_can_be_muted(can_manage, participants, participant); update_group_call_participant_can_be_muted(can_manage, participants, participant);
if (old_participant.is_volume_level_local && !participant.is_volume_level_local) {
participant.is_volume_level_local = true;
participant.volume_level = old_participant.volume_level;
}
participant.is_min = false;
LOG(INFO) << "Edit " << old_participant << " to " << participant; LOG(INFO) << "Edit " << old_participant << " to " << participant;
if (old_participant != participant && (old_participant.order != 0 || participant.order != 0)) { if (old_participant != participant && (old_participant.order != 0 || participant.order != 0)) {
@ -1383,6 +1388,7 @@ int GroupCallManager::process_group_call_participant(InputGroupCallId input_grou
return -1; return -1;
} }
// CHECK(!participant.is_min);
int diff = participant.is_just_joined ? 1 : 0; int diff = participant.is_just_joined ? 1 : 0;
if (participant.is_just_joined) { if (participant.is_just_joined) {
LOG(INFO) << "Add new " << participant; LOG(INFO) << "Add new " << participant;

View File

@ -25,6 +25,7 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
LOG(ERROR) << "Receive " << to_string(participant); LOG(ERROR) << "Receive " << to_string(participant);
volume_level = 10000; volume_level = 10000;
} }
is_volume_level_local = (participant->flags_ & telegram_api::groupCallParticipant::VOLUME_BY_ADMIN_MASK) == 0;
} }
if (!participant->left_) { if (!participant->left_) {
joined_date = participant->date_; joined_date = participant->date_;
@ -38,6 +39,7 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
} }
} }
is_just_joined = participant->just_joined_; is_just_joined = participant->just_joined_;
is_min = (participant->flags_ & telegram_api::groupCallParticipant::MIN_MASK) != 0;
} }
bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant) { bool GroupCallParticipant::is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant) {

View File

@ -23,6 +23,7 @@ struct GroupCallParticipant {
int32 joined_date = 0; int32 joined_date = 0;
int32 active_date = 0; int32 active_date = 0;
int32 volume_level = 10000; int32 volume_level = 10000;
bool is_volume_level_local = false;
bool is_muted = false; bool is_muted = false;
bool can_self_unmute = false; bool can_self_unmute = false;
bool is_muted_only_for_self = false; bool is_muted_only_for_self = false;
@ -32,6 +33,7 @@ struct GroupCallParticipant {
bool can_be_muted_only_for_self = false; bool can_be_muted_only_for_self = false;
bool can_be_unmuted_only_for_self = false; bool can_be_unmuted_only_for_self = false;
bool is_min = false;
bool is_just_joined = false; bool is_just_joined = false;
bool is_speaking = false; bool is_speaking = false;
int32 local_active_date = 0; int32 local_active_date = 0;