Lower the animated sticker requirements.

Fixes #6237.
This commit is contained in:
John Preston 2019-07-09 14:49:24 +02:00
parent 0710dde4d5
commit 9c909c8992
4 changed files with 11 additions and 5 deletions

View File

@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Lottie {
namespace {
const auto kIdealSize = QSize(512, 512);
std::string UnpackGzip(const QByteArray &bytes) {
const auto original = [&] {
return std::string(bytes.constData(), bytes.size());
@ -87,7 +89,7 @@ details::InitData Init(
return animation
? CheckSharedState(std::make_unique<SharedState>(
std::move(animation),
request,
request.empty() ? FrameRequest{ kIdealSize } : request,
quality))
: Error::ParseFailed;
}
@ -98,6 +100,8 @@ details::InitData Init(
const QByteArray &cached,
const FrameRequest &request,
Quality quality) {
Expects(!request.empty());
if (const auto error = ContentError(content)) {
return *error;
}

View File

@ -438,7 +438,7 @@ bool Cache::readHeader(const FrameRequest &request) {
|| (original.width() > kMaxSize)
|| (original.height() > kMaxSize)
|| (frameRate <= 0)
|| (frameRate > kMaxFrameRate)
|| (frameRate > kNormalFrameRate && frameRate != kMaxFrameRate)
|| (framesCount <= 0)
|| (framesCount > kMaxFramesCount)
|| (framesReady <= 0)

View File

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Lottie {
inline constexpr auto kTimeUnknown = std::numeric_limits<crl::time>::min();
inline constexpr auto kMaxFileSize = 1024 * 1024;
inline constexpr auto kMaxFileSize = 2 * 1024 * 1024;
class Animation;

View File

@ -23,9 +23,11 @@ class Animation;
namespace Lottie {
// Frame rate can be 1, 2, ... , 29, 30 or 60.
inline constexpr auto kNormalFrameRate = 30;
inline constexpr auto kMaxFrameRate = 60;
inline constexpr auto kMaxSize = 512;
inline constexpr auto kMaxFramesCount = 180;
inline constexpr auto kMaxSize = 4096;
inline constexpr auto kMaxFramesCount = 210;
inline constexpr auto kFrameDisplayTimeAlreadyDone
= std::numeric_limits<crl::time>::max();
inline constexpr auto kDisplayedInitial = crl::time(-1);