Prefer video dimensions over image size attribute.

This commit is contained in:
levlam 2021-01-28 15:03:52 +03:00
parent 3f856ccb46
commit 797aaecf2a
1 changed files with 6 additions and 2 deletions

View File

@ -110,8 +110,12 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
int32 video_duration = 0;
if (video != nullptr) {
video_duration = video->duration_;
if (dimensions.width == 0) {
dimensions = get_dimensions(video->w_, video->h_, "documentAttributeVideo");
auto video_dimensions = get_dimensions(video->w_, video->h_, "documentAttributeVideo");
if (dimensions.width == 0 || (video_dimensions.width != 0 && video_dimensions != dimensions)) {
if (dimensions.width != 0) {
LOG(ERROR) << "Receive ambiguous video dimensions " << dimensions << " and " << video_dimensions;
}
dimensions = video_dimensions;
}
if (animated != nullptr) {