From 9e3ad28d09b061534a411624c14fa1bc0c3e112f Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 1 Aug 2021 07:40:57 +0300 Subject: [PATCH] Allow video notes without sound and prevent their creation. --- td/telegram/DocumentsManager.cpp | 9 +++++++-- td/telegram/VideoNotesManager.cpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/td/telegram/DocumentsManager.cpp b/td/telegram/DocumentsManager.cpp index e66b4f731..977c6b573 100644 --- a/td/telegram/DocumentsManager.cpp +++ b/td/telegram/DocumentsManager.cpp @@ -118,9 +118,14 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo } if (animated != nullptr) { - // video animation type_attributes--; - video = nullptr; + if ((video->flags_ & telegram_api::documentAttributeVideo::ROUND_MESSAGE_MASK) != 0) { + // video note without sound + animated = nullptr; + } else { + // video animation + video = nullptr; + } } } if (animated != nullptr && audio != nullptr) { diff --git a/td/telegram/VideoNotesManager.cpp b/td/telegram/VideoNotesManager.cpp index cf967a041..cd9a6f691 100644 --- a/td/telegram/VideoNotesManager.cpp +++ b/td/telegram/VideoNotesManager.cpp @@ -219,7 +219,7 @@ tl_object_ptr VideoNotesManager::get_input_media( telegram_api::documentAttributeVideo::ROUND_MESSAGE_MASK, false /*ignored*/, false /*ignored*/, video_note->duration, video_note->dimensions.width ? video_note->dimensions.width : 240, video_note->dimensions.height ? video_note->dimensions.height : 240)); - int32 flags = 0; + int32 flags = telegram_api::inputMediaUploadedDocument::NOSOUND_VIDEO_MASK; if (input_thumbnail != nullptr) { flags |= telegram_api::inputMediaUploadedDocument::THUMB_MASK; }