From 0cfede984cb33c3d2605b9fb81dcbef0db9034df Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 24 Aug 2021 20:57:54 +0300 Subject: [PATCH] Update API scheme to layer 132. --- Telegram/Resources/tl/api.tl | 41 +++++++---- .../calls/group/calls_group_call.cpp | 70 +++++++++++++++++-- .../SourceFiles/data/data_cloud_themes.cpp | 2 +- Telegram/SourceFiles/data/data_group_call.cpp | 3 +- .../export/data/export_data_types.cpp | 2 + .../SourceFiles/history/history_service.cpp | 2 + .../history/view/history_view_send_action.cpp | 2 + .../SourceFiles/ui/image/image_location.cpp | 20 ++++-- .../window/window_session_controller.cpp | 3 +- Telegram/ThirdParty/tgcalls | 2 +- Telegram/cmake/lib_tgcalls.cmake | 8 ++- 11 files changed, 126 insertions(+), 29 deletions(-) diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index b001ef20d..82e59c8ba 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -92,7 +92,7 @@ inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes th inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation; inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation; inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation; -inputGroupCallStream#bba51639 call:InputGroupCall time_ms:long scale:int = InputFileLocation; +inputGroupCallStream#598a92a flags:# call:InputGroupCall time_ms:long scale:int video_channel:flags.0?int video_quality:flags.0?int = InputFileLocation; peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; @@ -128,8 +128,8 @@ chatForbidden#7328bdb id:int title:string = Chat; channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; -chatFull#8a1e2983 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer = ChatFull; -channelFull#548c3f93 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer = ChatFull; +chatFull#49a0a5d9 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string = ChatFull; +channelFull#2f532f3c flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant; @@ -187,6 +187,7 @@ messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int messageActionInviteToGroupCall#76b9f11a call:InputGroupCall users:Vector = MessageAction; messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction; messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction; +messageActionSetChatTheme#aa786345 emoticon:string = MessageAction; dialog#2c171f72 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -234,7 +235,7 @@ inputReportReasonCopyright#9b89f93a = ReportReason; inputReportReasonGeoIrrelevant#dbd4feed = ReportReason; inputReportReasonFake#f5ddd6e7 = ReportReason; -userFull#139a9a77 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int = UserFull; +userFull#d697ff05 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true user:User about:flags.1?string settings:PeerSettings profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; @@ -465,6 +466,7 @@ sendMessageRecordRoundAction#88f27fbc = SendMessageAction; sendMessageUploadRoundAction#243e1c66 progress:int = SendMessageAction; speakingInGroupCallAction#d92c2285 = SendMessageAction; sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction; +sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; @@ -1116,7 +1118,7 @@ restrictionReason#d072acb4 platform:string reason:string text:string = Restricti inputTheme#3c5693e9 id:long access_hash:long = InputTheme; inputThemeSlug#f5890df1 slug:string = InputTheme; -theme#28f1114 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:int = Theme; +theme#e802b8dc flags:# creator:flags.0?true default:flags.1?true for_chat:flags.5?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:flags.4?int = Theme; account.themesNotModified#f41eb622 = account.Themes; account.themes#7f676421 hash:int themes:Vector = account.Themes; @@ -1135,9 +1137,9 @@ baseThemeNight#b7b31ea8 = BaseTheme; baseThemeTinted#6d5f77ee = BaseTheme; baseThemeArctic#5b11125a = BaseTheme; -inputThemeSettings#bd507cd1 flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; +inputThemeSettings#ff38f912 flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int message_colors:flags.0?Vector wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; -themeSettings#9c14984a flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?WallPaper = ThemeSettings; +themeSettings#8db4e76c flags:# message_colors_animated:flags.2?true base_theme:BaseTheme accent_color:int message_colors:flags.0?Vector wallpaper:flags.1?WallPaper = ThemeSettings; webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector settings:flags.1?ThemeSettings = WebPageAttribute; @@ -1195,7 +1197,7 @@ messageViews#455b853d flags:# views:flags.0?int forwards:flags.1?int replies:fla messages.messageViews#b6c4f543 views:Vector chats:Vector users:Vector = messages.MessageViews; -messages.discussionMessage#f5dd8f9d flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int chats:Vector users:Vector = messages.DiscussionMessage; +messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader; @@ -1206,7 +1208,7 @@ peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked; stats.messageStats#8999f295 views_graph:StatsGraph = stats.MessageStats; groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall; -groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall; +groupCall#d597650c flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int = GroupCall; inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall; @@ -1265,6 +1267,15 @@ account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordR account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult; account.resetPasswordOk#e926d63e = account.ResetPasswordResult; +chatTheme#ed0b5c33 emoticon:string theme:Theme dark_theme:Theme = ChatTheme; + +account.chatThemesNotModified#e011e1c4 = account.ChatThemes; +account.chatThemes#fe4cbebd hash:int themes:Vector = account.ChatThemes; + +sponsoredMessage#f671f0d1 flags:# random_id:bytes peer_id:Peer from_id:Peer message:string media:flags.0?MessageMedia entities:flags.1?Vector = SponsoredMessage; + +messages.sponsoredMessages#65a4c7d5 messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1365,6 +1376,7 @@ account.setGlobalPrivacySettings#1edaaac2 settings:GlobalPrivacySettings = Globa account.reportProfilePhoto#fa8cc6f5 peer:InputPeer photo_id:InputPhoto reason:ReportReason message:string = Bool; account.resetPassword#9308ce1b = account.ResetPasswordResult; account.declinePasswordReset#4c9409f6 = Bool; +account.getChatThemes#d6d71d7b hash:int = account.ChatThemes; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; @@ -1402,7 +1414,7 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; messages.sendMessage#520c3870 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int = Updates; messages.sendMedia#3491eba9 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int = Updates; -messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer schedule_date:flags.10?int = Updates; +messages.forwardMessages#d9fee60e flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer schedule_date:flags.10?int = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; messages.report#8953ab4e peer:InputPeer id:Vector reason:ReportReason message:string = Bool; @@ -1533,6 +1545,7 @@ messages.getAdminsWithInvites#3920e6ef peer:InputPeer = messages.ChatAdminsWithI messages.getChatInviteImporters#26fb7289 peer:InputPeer link:string offset_date:int offset_user:InputUser limit:int = messages.ChatInviteImporters; messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates; messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer; +messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1611,6 +1624,8 @@ channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint addr channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; channels.getInactiveChannels#11e831ee = messages.InactiveChats; channels.convertToGigagroup#b290c69 channel:InputChannel = Updates; +channels.viewSponsoredMessage#beaedb94 channel:InputChannel random_id:bytes = Bool; +channels.getSponsoredMessages#ec210fbf channel:InputChannel = messages.SponsoredMessages; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -1649,10 +1664,10 @@ phone.leaveGroupCall#500377f9 call:InputGroupCall source:int = Updates; phone.inviteToGroupCall#7b393160 call:InputGroupCall users:Vector = Updates; phone.discardGroupCall#7a777135 call:InputGroupCall = Updates; phone.toggleGroupCallSettings#74bbb43d flags:# reset_invite_hash:flags.1?true call:InputGroupCall join_muted:flags.0?Bool = Updates; -phone.getGroupCall#c7cb017 call:InputGroupCall = phone.GroupCall; +phone.getGroupCall#41845db call:InputGroupCall limit:int = phone.GroupCall; phone.getGroupParticipants#c558d8ab call:InputGroupCall ids:Vector sources:Vector offset:string limit:int = phone.GroupParticipants; phone.checkGroupCall#b59cf977 call:InputGroupCall sources:Vector = Vector; -phone.toggleGroupCallRecord#c02a66d7 flags:# start:flags.0?true call:InputGroupCall title:flags.1?string = Updates; +phone.toggleGroupCallRecord#f128c708 flags:# start:flags.0?true video:flags.2?true call:InputGroupCall title:flags.1?string video_portrait:flags.2?Bool = Updates; phone.editGroupCallParticipant#a5273abf flags:# call:InputGroupCall participant:InputPeer muted:flags.0?Bool volume:flags.1?int raise_hand:flags.2?Bool video_stopped:flags.3?Bool video_paused:flags.4?Bool presentation_paused:flags.5?Bool = Updates; phone.editGroupCallTitle#1ca6ac0a call:InputGroupCall title:string = Updates; phone.getGroupCallJoinAs#ef7c213a peer:InputPeer = phone.JoinAsPeers; @@ -1678,4 +1693,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -// LAYER 131 +// LAYER 132 diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 24922f9cd..7f8ea998c 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -126,11 +126,19 @@ using JoinClientFields = std::variant< class GroupCall::LoadPartTask final : public tgcalls::BroadcastPartTask { public: + using Quality = tgcalls::VideoChannelDescription::Quality; LoadPartTask( base::weak_ptr call, int64 time, int64 period, Fn done); + LoadPartTask( + base::weak_ptr call, + int64 time, + int64 period, + int32 videoChannel, + Quality videoQuality, + Fn done); [[nodiscard]] int64 time() const { return _time; @@ -138,6 +146,12 @@ public: [[nodiscard]] int32 scale() const { return _scale; } + [[nodiscard]] int32 videoChannel() const { + return _videoChannel; + } + [[nodiscard]] Quality videoQuality() const { + return _videoQuality; + } void done(tgcalls::BroadcastPart &&part); void cancel() override; @@ -146,6 +160,8 @@ private: const base::weak_ptr _call; const int64 _time = 0; const int32 _scale = 0; + const int32 _videoChannel = 0; + const Quality _videoQuality = {}; Fn _done; QMutex _mutex; @@ -379,7 +395,17 @@ GroupCall::LoadPartTask::LoadPartTask( base::weak_ptr call, int64 time, int64 period, - Fn done) + Fn done) +: LoadPartTask(std::move(call), time, period, 0, {}, std::move(done)) { +} + +GroupCall::LoadPartTask::LoadPartTask( + base::weak_ptr call, + int64 time, + int64 period, + int32 videoChannel, + tgcalls::VideoChannelDescription::Quality videoQuality, + Fn done) : _call(std::move(call)) , _time(time ? time : (base::unixtime::now() * int64(1000))) , _scale([&] { @@ -391,6 +417,8 @@ GroupCall::LoadPartTask::LoadPartTask( } Unexpected("Period in LoadPartTask."); }()) +, _videoChannel(videoChannel) +, _videoQuality(videoQuality) , _done(std::move(done)) { } @@ -2190,7 +2218,8 @@ void GroupCall::toggleRecording(bool enabled, const QString &title) { MTP_flags((enabled ? Flag::f_start : Flag(0)) | (title.isEmpty() ? Flag(0) : Flag::f_title)), inputCall(), - MTP_string(title) + MTP_string(title), + MTPBool() // video_portrait )).done([=](const MTPUpdates &result) { _peer->session().api().applyUpdates(result); _recordingStoppedByMe = false; @@ -2234,7 +2263,7 @@ bool GroupCall::tryCreateController() { .createAudioDeviceModule = Webrtc::AudioDeviceModuleCreator( settings.callAudioBackend()), .videoCapture = _cameraCapture, - .requestBroadcastPart = [=, call = base::make_weak(this)]( + .requestAudioBroadcastPart = [=, call = base::make_weak(this)]( int64_t time, int64_t period, std::function done) { @@ -2248,6 +2277,24 @@ bool GroupCall::tryCreateController() { }); return result; }, + .requestVideoBroadcastPart = [=, call = base::make_weak(this)]( + int64_t time, + int64_t period, + int32_t channel, + tgcalls::VideoChannelDescription::Quality quality, + std::function done) { + auto result = std::make_shared( + call, + time, + period, + channel, + quality, + std::move(done)); + crl::on_main(weak, [=]() mutable { + broadcastPartStart(std::move(result)); + }); + return result; + }, .videoContentType = tgcalls::VideoContentType::Generic, .initialEnableNoiseSuppression = settings.groupCallNoiseSuppression(), @@ -2326,17 +2373,30 @@ void GroupCall::broadcastPartStart(std::shared_ptr task) { const auto raw = task.get(); const auto time = raw->time(); const auto scale = raw->scale(); + const auto videoChannel = raw->videoChannel(); + const auto videoQuality = raw->videoQuality(); const auto finish = [=](tgcalls::BroadcastPart &&part) { raw->done(std::move(part)); _broadcastParts.erase(raw); }; using Status = tgcalls::BroadcastPart::Status; + using Quality = tgcalls::VideoChannelDescription::Quality; + using Flag = MTPDinputGroupCallStream::Flag; const auto requestId = _api.request(MTPupload_GetFile( MTP_flags(0), MTP_inputGroupCallStream( + MTP_flags(videoChannel + ? (Flag::f_video_channel | Flag::f_video_quality) + : Flag(0)), inputCall(), MTP_long(time), - MTP_int(scale)), + MTP_int(scale), + MTP_int(videoChannel), + MTP_int((videoQuality == Quality::Full) + ? 2 + : (videoQuality == Quality::Medium) + ? 1 + : 0)), MTP_int(0), MTP_int(128 * 1024) )).done([=]( @@ -2350,7 +2410,7 @@ void GroupCall::broadcastPartStart(std::shared_ptr task) { .timestampMilliseconds = time, .responseTimestamp = TimestampFromMsgId(response.outerMsgId), .status = Status::Success, - .oggData = std::move(bytes), + .data = std::move(bytes), }); }, [&](const MTPDupload_fileCdnRedirect &data) { LOG(("Voice Chat Stream Error: fileCdnRedirect received.")); diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index ee59cac2b..e8150da07 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -42,7 +42,7 @@ CloudTheme CloudTheme::Parse( ? session->data().processDocument(*document)->id : DocumentId(0)), data.is_creator() ? session->userId() : UserId(0), - data.vinstalls_count().v + data.vinstalls_count().value_or_empty() }; } diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index de6478890..87daadcce 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -496,8 +496,9 @@ void GroupCall::reload() { } _reloadByQueuedUpdatesTimer.cancel(); + const auto limit = 3; _reloadRequestId = api().request( - MTPphone_GetGroupCall(input()) + MTPphone_GetGroupCall(input(), MTP_int(limit)) ).done([=](const MTPphone_GroupCall &result) { if (requestParticipantsAfterReload(result)) { _savedFull = result; diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index 421b02d67..c331e4237 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -1123,6 +1123,8 @@ ServiceAction ParseServiceAction( result.content = ActionGroupCallScheduled{ .date = data.vschedule_date().v, }; + }, [&](const MTPDmessageActionSetChatTheme &data) { + // #TODO themes }, [](const MTPDmessageActionEmpty &data) {}); return result; } diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 10fd3111e..aef8525a3 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -484,6 +484,8 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { return prepareSetMessagesTTL(data); }, [&](const MTPDmessageActionGroupCallScheduled &data) { return prepareCallScheduledText(data.vschedule_date().v); + }, [&](const MTPDmessageActionSetChatTheme &data) { + return PreparedText{ tr::lng_message_empty(tr::now) }; // #TODO themes }, [](const MTPDmessageActionEmpty &) { return PreparedText{ tr::lng_message_empty(tr::now) }; }); diff --git a/Telegram/SourceFiles/history/view/history_view_send_action.cpp b/Telegram/SourceFiles/history/view/history_view_send_action.cpp index a9a3c2eb0..e4508cef1 100644 --- a/Telegram/SourceFiles/history/view/history_view_send_action.cpp +++ b/Telegram/SourceFiles/history/view/history_view_send_action.cpp @@ -106,6 +106,8 @@ bool SendActionPainter::updateNeedsAnimating( user, now + kStatusShowClientsideSpeaking); }, [&](const MTPDsendMessageHistoryImportAction &) { + }, [&](const MTPDsendMessageChooseStickerAction &) { + // #TODO send_action }, [&](const MTPDsendMessageCancelAction &) { Unexpected("CancelAction here."); }); diff --git a/Telegram/SourceFiles/ui/image/image_location.cpp b/Telegram/SourceFiles/ui/image/image_location.cpp index 942a94ab5..9b934528c 100644 --- a/Telegram/SourceFiles/ui/image/image_location.cpp +++ b/Telegram/SourceFiles/ui/image/image_location.cpp @@ -174,6 +174,8 @@ StorageFileLocation::StorageFileLocation( }); _volumeId = data.vtime_ms().v; _localId = data.vscale().v; + _sizeLetter = uint8(data.vvideo_channel().value_or_empty() & 0x3F) + | uint8((data.vvideo_quality().value_or_empty() & 0x03) << 6); }); } @@ -265,9 +267,15 @@ MTPInputFileLocation StorageFileLocation::tl(UserId self) const { case Type::GroupCallStream: return MTP_inputGroupCallStream( + MTP_flags((_sizeLetter != 0) + ? (MTPDinputGroupCallStream::Flag::f_video_channel + | MTPDinputGroupCallStream::Flag::f_video_quality) + : MTPDinputGroupCallStream::Flag(0)), MTP_inputGroupCall(MTP_long(_id), MTP_long(_accessHash)), MTP_long(_volumeId), - MTP_int(_localId)); + MTP_int(_localId), + MTP_int(_sizeLetter & 0x3F), + MTP_int((_sizeLetter >> 6) & 0x03)); } Unexpected("Type in StorageFileLocation::tl."); @@ -479,7 +487,8 @@ Storage::Cache::Key StorageFileLocation::cacheKey() const { (shifted | sliced | (uint32(_localId) << 16) - | (_volumeId << 20)), + | (_volumeId << 20) + | (uint64(_sizeLetter) << 56)), _id }; } return Key(); @@ -607,7 +616,8 @@ bool operator==(const StorageFileLocation &a, const StorageFileLocation &b) { case Type::GroupCallStream: return (a._dcId == b._dcId) && (a._id == b._id) - && (a._localId == b._localId); + && (a._localId == b._localId) + && (a._sizeLetter == b._sizeLetter); }; Unexpected("Type in StorageFileLocation::operator==."); } @@ -661,8 +671,8 @@ bool operator<(const StorageFileLocation &a, const StorageFileLocation &b) { < std::tie(b._id, b._localId, b._volumeId, b._dcId); case Type::GroupCallStream: - return std::tie(a._id, a._localId, a._dcId) - < std::tie(b._id, b._localId, b._dcId); + return std::tie(a._id, a._localId, a._dcId, a._sizeLetter) + < std::tie(b._id, b._localId, b._dcId, b._sizeLetter); }; Unexpected("Type in StorageFileLocation::operator==."); } diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index e0c2804e0..a6773c5ff 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -320,8 +320,9 @@ void SessionNavigation::showPeerByLinkResolved( return; } const auto id = call->id(); + const auto limit = 3; _resolveRequestId = _session->api().request( - MTPphone_GetGroupCall(call->input()) + MTPphone_GetGroupCall(call->input(), MTP_int(limit)) ).done([=](const MTPphone_GroupCall &result) { if (const auto now = peer->groupCall() ; now && now->id() == id) { diff --git a/Telegram/ThirdParty/tgcalls b/Telegram/ThirdParty/tgcalls index 412834578..d287c56b9 160000 --- a/Telegram/ThirdParty/tgcalls +++ b/Telegram/ThirdParty/tgcalls @@ -1 +1 @@ -Subproject commit 412834578762440fe45d88b84aedbca3e66b1d63 +Subproject commit d287c56b96a6f8bb58530e471e256f1ebe7785fb diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake index 45bebc074..7d94d3d4b 100644 --- a/Telegram/cmake/lib_tgcalls.cmake +++ b/Telegram/cmake/lib_tgcalls.cmake @@ -71,6 +71,8 @@ PRIVATE desktop_capturer/DesktopCaptureSourceManager.cpp # Group calls + group/AudioStreamingPart.cpp + group/AudioStreamingPart.h group/GroupInstanceCustomImpl.cpp group/GroupInstanceCustomImpl.h group/GroupInstanceImpl.h @@ -79,8 +81,10 @@ PRIVATE group/GroupJoinPayload.h group/GroupNetworkManager.cpp group/GroupNetworkManager.h - group/StreamingPart.cpp - group/StreamingPart.h + group/StreamingMediaContext.cpp + group/StreamingMediaContext.h + group/VideoStreamingPart.cpp + group/VideoStreamingPart.h platform/PlatformInterface.h