diff --git a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp index b6bd69426..263ff877e 100644 --- a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp +++ b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp @@ -18,6 +18,7 @@ namespace { constexpr auto kSkipInvalidDataPackets = 10; constexpr auto kMaxInlineArea = 1280 * 720; +constexpr auto kMaxSendingArea = 3840 * 2160; // usual 4K // See https://github.com/telegramdesktop/tdesktop/issues/7225 constexpr auto kAlignImageBy = 64; @@ -60,7 +61,10 @@ ReaderImplementation::ReadResult FFMpegReaderImplementation::readNextFrame() { do { int res = avcodec_receive_frame(_codecContext, _frame.get()); if (res >= 0) { - if (_frame->width * _frame->height > kMaxInlineArea) { + const auto limit = (_mode == Mode::Inspecting) + ? kMaxSendingArea + : kMaxInlineArea; + if (_frame->width * _frame->height > limit) { return ReadResult::Error; } processReadFrame();