Update layer 131. Add screen_sharing_audio_source_id.

This commit is contained in:
levlam 2021-07-06 02:33:42 +03:00
parent 5176710ada
commit ff153bef36
8 changed files with 26 additions and 15 deletions

View File

@ -2187,6 +2187,7 @@ groupCallParticipantVideoInfo source_groups:vector<groupCallVideoSourceGroup> en
//@description Represents a group call participant
//@participant_id Identifier of the group call participant
//@audio_source_id User's audio channel synchronization source identifier
//@screen_sharing_audio_source_id User's screen sharing audio channel synchronization source identifier
//@can_enable_video True, if the user can broadcast video or share screen
//@video_info Information about user's video channel; may be null if there is no active video
//@screen_sharing_video_info Information about user's screen sharing video channel; may be null if there is no active screen sharing video
@ -2203,7 +2204,7 @@ groupCallParticipantVideoInfo source_groups:vector<groupCallVideoSourceGroup> en
//@can_unmute_self True, if the participant is muted for all users, but can unmute themselves
//@volume_level Participant's volume level; 1-20000 in hundreds of percents
//@order User's order in the group call participant list. Orders must be compared lexicographically. The bigger is order, the higher is user in the list. If order is empty, the user must be removed from the participant list
groupCallParticipant participant_id:MessageSender audio_source_id:int32 can_enable_video:Bool video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant;
groupCallParticipant participant_id:MessageSender audio_source_id:int32 screen_sharing_audio_source_id:int32 can_enable_video:Bool video_info:groupCallParticipantVideoInfo screen_sharing_video_info:groupCallParticipantVideoInfo bio:string is_current_user:Bool is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant;
//@class CallProblem @description Describes the exact type of a problem with a call
@ -4791,8 +4792,11 @@ toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notifi
//@invite_hash If non-empty, invite hash to be used to join the group call without being muted by administrators
joinGroupCall group_call_id:int32 participant_id:MessageSender audio_source_id:int32 payload:string is_muted:Bool is_my_video_enabled:Bool invite_hash:string = Text;
//@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls @group_call_id Group call identifier @payload Group call join payload; received from tgcalls
startGroupCallScreenSharing group_call_id:int32 payload:string = Text;
//@description Starts screen sharing in a joined group call. Returns join response payload for tgcalls
//@group_call_id Group call identifier
//@audio_source_id Screen sharing audio channel synchronization source identifier; received from tgcalls
//@payload Group call join payload; received from tgcalls
startGroupCallScreenSharing group_call_id:int32 audio_source_id:int32 payload:string = Text;
//@description Pauses or unpauses screen sharing in a joined group call @group_call_id Group call identifier @is_paused True if screen sharing is paused
toggleGroupCallScreenSharingIsPaused group_call_id:int32 is_paused:Bool = Ok;

View File

@ -1239,7 +1239,7 @@ phone.exportedGroupCallInvite#204bd158 link:string = phone.ExportedGroupCallInvi
groupCallParticipantVideoSourceGroup#dcb118b7 semantics:string sources:Vector<int> = GroupCallParticipantVideoSourceGroup;
groupCallParticipantVideo#78e41663 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> = GroupCallParticipantVideo;
groupCallParticipantVideo#67753ac8 flags:# paused:flags.0?true endpoint:string source_groups:Vector<GroupCallParticipantVideoSourceGroup> audio_source:flags.1?int = GroupCallParticipantVideo;
stickers.suggestedShortName#85fea03f short_name:string = stickers.SuggestedShortName;

View File

@ -2503,7 +2503,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
try_load_group_call_administrators(input_group_call_id, group_call->dialog_id);
}
void GroupCallManager::start_group_call_screen_sharing(GroupCallId group_call_id, string &&payload,
void GroupCallManager::start_group_call_screen_sharing(GroupCallId group_call_id, int32 audio_source, string &&payload,
Promise<string> &&promise) {
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
@ -2515,12 +2515,12 @@ void GroupCallManager::start_group_call_screen_sharing(GroupCallId group_call_id
if (!group_call->is_joined || group_call->is_being_left) {
if (is_group_call_being_joined(input_group_call_id) || group_call->need_rejoin) {
group_call->after_join.push_back(
PromiseCreator::lambda([actor_id = actor_id(this), group_call_id, payload = std::move(payload),
PromiseCreator::lambda([actor_id = actor_id(this), group_call_id, audio_source, payload = std::move(payload),
promise = std::move(promise)](Result<Unit> &&result) mutable {
if (result.is_error()) {
promise.set_error(Status::Error(400, "GROUPCALL_JOIN_MISSING"));
} else {
send_closure(actor_id, &GroupCallManager::start_group_call_screen_sharing, group_call_id,
send_closure(actor_id, &GroupCallManager::start_group_call_screen_sharing, group_call_id, audio_source,
std::move(payload), std::move(promise));
}
}));
@ -2535,6 +2535,7 @@ void GroupCallManager::start_group_call_screen_sharing(GroupCallId group_call_id
auto &request = pending_join_presentation_requests_[input_group_call_id];
request = make_unique<PendingJoinRequest>();
request->generation = generation;
request->audio_source = audio_source;
request->promise = std::move(promise);
request->query_ref =
@ -4418,7 +4419,7 @@ DialogId GroupCallManager::set_group_call_participant_is_speaking_by_source(Inpu
}
for (auto &participant : participants_it->second->participants) {
if (participant.audio_source == audio_source) {
if (participant.audio_source == audio_source || participant.presentation_audio_source == audio_source) {
if (is_speaking && participant.get_is_muted_by_admin()) {
// don't allow to show as speaking muted by admin participants
return DialogId();

View File

@ -67,7 +67,8 @@ class GroupCallManager final : public Actor {
void join_group_call(GroupCallId group_call_id, DialogId as_dialog_id, int32 audio_source, string &&payload,
bool is_muted, bool is_my_video_enabled, const string &invite_hash, Promise<string> &&promise);
void start_group_call_screen_sharing(GroupCallId group_call_id, string &&payload, Promise<string> &&promise);
void start_group_call_screen_sharing(GroupCallId group_call_id, int32 audio_source, string &&payload,
Promise<string> &&promise);
void end_group_call_screen_sharing(GroupCallId group_call_id, Promise<Unit> &&promise);

View File

@ -61,6 +61,9 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
video_payload = get_group_call_video_payload(participant->video_.get());
}
if (participant->presentation_ != nullptr) {
if (participant->presentation_->flags_ & telegram_api::groupCallParticipantVideo::AUDIO_SOURCE_MASK) {
presentation_audio_source = participant->presentation_->audio_source_;
}
presentation_payload = get_group_call_video_payload(participant->presentation_.get());
}
}
@ -255,8 +258,8 @@ td_api::object_ptr<td_api::groupCallParticipant> GroupCallParticipant::get_group
}
return td_api::make_object<td_api::groupCallParticipant>(
td->messages_manager_->get_message_sender_object(dialog_id), audio_source, can_enable_video,
get_group_call_participant_video_info_object(video_payload),
td->messages_manager_->get_message_sender_object(dialog_id), audio_source, presentation_audio_source,
can_enable_video, get_group_call_participant_video_info_object(video_payload),
get_group_call_participant_video_info_object(presentation_payload), about, is_self, is_speaking,
get_is_hand_raised(), can_be_muted_for_all_users, can_be_unmuted_for_all_users, can_be_muted_only_for_self,
can_be_unmuted_only_for_self, get_is_muted_for_all_users(), get_is_muted_locally(), get_is_muted_by_themselves(),
@ -265,6 +268,7 @@ td_api::object_ptr<td_api::groupCallParticipant> GroupCallParticipant::get_group
bool operator==(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs) {
return lhs.dialog_id == rhs.dialog_id && lhs.audio_source == rhs.audio_source &&
lhs.presentation_audio_source == rhs.presentation_audio_source &&
lhs.can_enable_video == rhs.can_enable_video && lhs.video_payload == rhs.video_payload &&
lhs.presentation_payload == rhs.presentation_payload && lhs.about == rhs.about && lhs.is_self == rhs.is_self &&
lhs.is_speaking == rhs.is_speaking && lhs.get_is_hand_raised() == rhs.get_is_hand_raised() &&

View File

@ -25,6 +25,7 @@ struct GroupCallParticipant {
GroupCallVideoPayload video_payload;
GroupCallVideoPayload presentation_payload;
int32 audio_source = 0;
int32 presentation_audio_source = 0;
int32 joined_date = 0;
int32 active_date = 0;
int32 volume_level = 10000;

View File

@ -6084,8 +6084,8 @@ void Td::on_request(uint64 id, td_api::startGroupCallScreenSharing &request) {
promise.set_value(make_tl_object<td_api::text>(result.move_as_ok()));
}
});
group_call_manager_->start_group_call_screen_sharing(GroupCallId(request.group_call_id_), std::move(request.payload_),
std::move(query_promise));
group_call_manager_->start_group_call_screen_sharing(GroupCallId(request.group_call_id_), request.audio_source_id_,
std::move(request.payload_), std::move(query_promise));
}
void Td::on_request(uint64 id, const td_api::toggleGroupCallScreenSharingIsPaused &request) {

View File

@ -2803,8 +2803,8 @@ class CliClient final : public Actor {
sim_sources + ",\"semantics\":\"SIM\"},{\"sources\":" + fid_sources + ",\"semantics\":\"FID\"}]}";
}
if (op == "sgcss") {
send_request(td_api::make_object<td_api::startGroupCallScreenSharing>(as_group_call_id(group_call_id),
std::move(payload)));
send_request(td_api::make_object<td_api::startGroupCallScreenSharing>(
as_group_call_id(group_call_id), group_call_source_ + 1, std::move(payload)));
} else {
send_request(td_api::make_object<td_api::joinGroupCall>(as_group_call_id(group_call_id),
as_message_sender(participant_id), group_call_source_,