Merge remote-tracking branch 'td/master'
This commit is contained in:
commit
ae7b502a6e
@ -3239,7 +3239,7 @@ networkStatistics since_date:int32 entries:vector<NetworkStatisticsEntry> = Netw
|
||||
//@max_photo_file_size The maximum size of a photo file to be auto-downloaded
|
||||
//@max_video_file_size The maximum size of a video file to be auto-downloaded
|
||||
//@max_other_file_size The maximum size of other file types to be auto-downloaded
|
||||
//@video_upload_bitrate The maximum suggested bitrate for uploaded videos
|
||||
//@video_upload_bitrate The maximum suggested bitrate for uploaded videos, in kbit/s
|
||||
//@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback
|
||||
//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file
|
||||
//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled
|
||||
|
@ -1678,6 +1678,38 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (key == "round_video_encoding") {
|
||||
if (value->get_id() == telegram_api::jsonObject::ID) {
|
||||
auto video_note_settings = std::move(static_cast<telegram_api::jsonObject *>(value)->value_);
|
||||
for (auto &video_note_setting : video_note_settings) {
|
||||
CHECK(video_note_setting != nullptr);
|
||||
if (video_note_setting->key_ != "diameter" && video_note_setting->key_ != "video_bitrate" &&
|
||||
video_note_setting->key_ != "audio_bitrate") {
|
||||
continue;
|
||||
}
|
||||
if (video_note_setting->value_->get_id() == telegram_api::jsonNumber::ID) {
|
||||
auto setting_value = static_cast<int32>(
|
||||
static_cast<const telegram_api::jsonNumber *>(video_note_setting->value_.get())->value_);
|
||||
if (value > 0) {
|
||||
if (video_note_setting->key_ == "diameter") {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_length", setting_value);
|
||||
}
|
||||
if (video_note_setting->key_ == "video_bitrate") {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_video_bitrate", setting_value);
|
||||
}
|
||||
if (video_note_setting->key_ == "audio_bitrate") {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_audio_bitrate", setting_value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "Receive unexpected video note setting " << to_string(video_note_setting);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "Receive unexpected round_video_encoding " << to_string(*value);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
new_values.push_back(std::move(key_value));
|
||||
}
|
||||
|
@ -7446,7 +7446,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
|
||||
|
||||
auto channel_id = dialog_id.get_channel_id();
|
||||
if (!td_->contacts_manager_->have_channel(channel_id) && td_->contacts_manager_->have_min_channel(channel_id)) {
|
||||
td_->updates_manager_->schedule_get_difference("on_update_new_channel_message");
|
||||
td_->updates_manager_->schedule_get_difference("add_pending_channel_update 1");
|
||||
promise.set_value(Unit());
|
||||
return;
|
||||
}
|
||||
@ -7454,7 +7454,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
|
||||
// TODO need to save all updates that can change result of running queries not associated with pts (for example
|
||||
// getHistory) and apply them to result of these queries
|
||||
|
||||
Dialog *d = get_dialog_force(dialog_id, "add_pending_channel_update");
|
||||
Dialog *d = get_dialog_force(dialog_id, "add_pending_channel_update 2");
|
||||
if (d == nullptr) {
|
||||
auto pts = load_channel_pts(dialog_id);
|
||||
if (pts > 0) {
|
||||
@ -7465,13 +7465,30 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
|
||||
return;
|
||||
}
|
||||
|
||||
d = add_dialog(dialog_id, "add_pending_channel_update");
|
||||
if (new_pts <= pts && new_pts >= pts - 19999) {
|
||||
LOG(INFO) << "There is no need to process an update with pts " << new_pts << " in " << dialog_id << " with pts "
|
||||
<< pts;
|
||||
promise.set_value(Unit());
|
||||
return;
|
||||
}
|
||||
|
||||
if (new_pts > pts && pts != new_pts - pts_count) {
|
||||
LOG(INFO) << "Found a gap in the " << dialog_id << " with pts = " << pts << ". new_pts = " << new_pts
|
||||
<< ", pts_count = " << pts_count << " in update from " << source;
|
||||
auto enable_pull_based_backpressure
|
||||
= G()->shared_config().get_option_boolean("enable_pull_based_backpressure", false);
|
||||
get_channel_difference_delayed(dialog_id, pts, true, enable_pull_based_backpressure, "add_pending_channel_update 3");
|
||||
promise.set_value(Unit());
|
||||
return;
|
||||
}
|
||||
|
||||
d = add_dialog(dialog_id, "add_pending_channel_update 4");
|
||||
if (d == nullptr) {
|
||||
LOG(ERROR) << "Unknown dialog " << dialog_id;
|
||||
return;
|
||||
}
|
||||
CHECK(d->pts == pts);
|
||||
update_dialog_pos(d, "add_pending_channel_update");
|
||||
update_dialog_pos(d, "add_pending_channel_update 5");
|
||||
}
|
||||
}
|
||||
if (d == nullptr) {
|
||||
@ -36051,6 +36068,7 @@ void MessagesManager::on_get_channel_difference(
|
||||
VLOG(messages) << "Receive result of getChannelDifference for " << dialog_id << " with pts = " << request_pts
|
||||
<< " and limit = " << request_limit << ": " << to_string(difference_ptr);
|
||||
|
||||
bool have_new_messages = false;
|
||||
switch (difference_ptr->get_id()) {
|
||||
case telegram_api::updates_channelDifferenceEmpty::ID:
|
||||
if (d == nullptr) {
|
||||
@ -36061,12 +36079,14 @@ void MessagesManager::on_get_channel_difference(
|
||||
break;
|
||||
case telegram_api::updates_channelDifference::ID: {
|
||||
auto difference = static_cast<telegram_api::updates_channelDifference *>(difference_ptr.get());
|
||||
have_new_messages = !difference->new_messages_.empty();
|
||||
td_->contacts_manager_->on_get_users(std::move(difference->users_), "updates.channelDifference");
|
||||
td_->contacts_manager_->on_get_chats(std::move(difference->chats_), "updates.channelDifference");
|
||||
break;
|
||||
}
|
||||
case telegram_api::updates_channelDifferenceTooLong::ID: {
|
||||
auto difference = static_cast<telegram_api::updates_channelDifferenceTooLong *>(difference_ptr.get());
|
||||
have_new_messages = difference->dialog_->get_id() == telegram_api::dialog::ID && !difference->messages_.empty();
|
||||
td_->contacts_manager_->on_get_users(std::move(difference->users_), "updates.channelDifferenceTooLong");
|
||||
td_->contacts_manager_->on_get_chats(std::move(difference->chats_), "updates.channelDifferenceTooLong");
|
||||
break;
|
||||
@ -36077,7 +36097,12 @@ void MessagesManager::on_get_channel_difference(
|
||||
|
||||
bool need_update_dialog_pos = false;
|
||||
if (d == nullptr) {
|
||||
if (have_new_messages) {
|
||||
CHECK(!being_added_by_new_message_dialog_id_.is_valid());
|
||||
being_added_by_new_message_dialog_id_ = dialog_id;
|
||||
}
|
||||
d = add_dialog(dialog_id, "on_get_channel_difference");
|
||||
being_added_by_new_message_dialog_id_ = DialogId();
|
||||
need_update_dialog_pos = true;
|
||||
}
|
||||
|
||||
|
@ -5064,9 +5064,10 @@ void StickersManager::on_uploaded_sticker_file(FileId file_id, tl_object_ptr<tel
|
||||
}
|
||||
|
||||
if (is_animated) {
|
||||
merge_stickers(parsed_document.file_id, file_id, true);
|
||||
merge_stickers(parsed_document.file_id, file_id, false);
|
||||
} else {
|
||||
td_->documents_manager_->merge_documents(parsed_document.file_id, file_id, true);
|
||||
// must not delete the old document, because the file_id could be used for simultaneous URL uploads
|
||||
td_->documents_manager_->merge_documents(parsed_document.file_id, file_id, false);
|
||||
}
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
@ -4283,6 +4283,15 @@ void Td::init_options_and_network() {
|
||||
if (!G()->shared_config().have_option("message_caption_length_max")) {
|
||||
G()->shared_config().set_option_integer("message_caption_length_max", 1024);
|
||||
}
|
||||
if (!G()->shared_config().have_option("suggested_video_note_length")) {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_length", 384);
|
||||
}
|
||||
if (!G()->shared_config().have_option("suggested_video_note_video_bitrate")) {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_video_bitrate", 1000);
|
||||
}
|
||||
if (!G()->shared_config().have_option("suggested_video_note_audio_bitrate")) {
|
||||
G()->shared_config().set_option_integer("suggested_video_note_audio_bitrate", 64);
|
||||
}
|
||||
|
||||
init_connection_creator();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user