From 3d431a27cb91618992668686f9c306d121c3f6a5 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 19 Apr 2020 11:14:02 +0400 Subject: [PATCH] Improve inline thumbnail usage in PiP player. --- Telegram/SourceFiles/media/view/media_view_pip.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/media/view/media_view_pip.cpp b/Telegram/SourceFiles/media/view/media_view_pip.cpp index bedd02522..99e73c292 100644 --- a/Telegram/SourceFiles/media/view/media_view_pip.cpp +++ b/Telegram/SourceFiles/media/view/media_view_pip.cpp @@ -1372,13 +1372,17 @@ QImage Pip::videoFrame(const FrameRequest &request) const { } const auto &cover = _instance.info().video.cover; - // #TODO optimize always use when available const auto media = _data->activeMediaView(); - const auto good = media ? media->goodThumbnail() : nullptr; + const auto use = media + ? media + : _data->inlineThumbnailBytes().isEmpty() + ? nullptr + : _data->createMediaView(); + const auto good = use ? use->goodThumbnail() : nullptr; const auto useGood = (good && good->loaded()); - const auto thumb = media ? media->thumbnail() : nullptr; + const auto thumb = use ? use->thumbnail() : nullptr; const auto useThumb = (thumb && thumb->loaded()); - const auto blurred = media ? media->thumbnailInline() : nullptr; + const auto blurred = use ? use->thumbnailInline() : nullptr; const auto state = !cover.isNull() ? ThumbState::Cover