mirror of https://github.com/procxx/kepka.git
Fix sending videos larger than 720p.
This commit is contained in:
parent
df290605f4
commit
735f7709b9
|
@ -18,6 +18,7 @@ namespace {
|
||||||
|
|
||||||
constexpr auto kSkipInvalidDataPackets = 10;
|
constexpr auto kSkipInvalidDataPackets = 10;
|
||||||
constexpr auto kMaxInlineArea = 1280 * 720;
|
constexpr auto kMaxInlineArea = 1280 * 720;
|
||||||
|
constexpr auto kMaxSendingArea = 3840 * 2160; // usual 4K
|
||||||
|
|
||||||
// See https://github.com/telegramdesktop/tdesktop/issues/7225
|
// See https://github.com/telegramdesktop/tdesktop/issues/7225
|
||||||
constexpr auto kAlignImageBy = 64;
|
constexpr auto kAlignImageBy = 64;
|
||||||
|
@ -60,7 +61,10 @@ ReaderImplementation::ReadResult FFMpegReaderImplementation::readNextFrame() {
|
||||||
do {
|
do {
|
||||||
int res = avcodec_receive_frame(_codecContext, _frame.get());
|
int res = avcodec_receive_frame(_codecContext, _frame.get());
|
||||||
if (res >= 0) {
|
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;
|
return ReadResult::Error;
|
||||||
}
|
}
|
||||||
processReadFrame();
|
processReadFrame();
|
||||||
|
|
Loading…
Reference in New Issue