Probe desktop Full HD codecs and retain GPU support by size

This commit is contained in:
evgeny committed 2026-10-19 22:37:29 +02:00
1 parent 720ee64fd1
commit bf8dfeec02
2 files changed
+53 -28

No files matched your search

+19 -13
View File
@@ -256,19 +256,25 @@ void CallVideoEngine::transmit() {
call_video_caps caps = CallVideoDecoder::capabilities();
// Не связываем приём с наличием собственного encoder.
for (unsigned codec = 1; codec <= 2 && m->running; ++codec) {
call_video_format probe{1, 1280, 720, 30, 0, (uint8_t)codec, (uint8_t)(codec == 1 ? 31 : 93), 4000000,
(uint8_t)(codec == 1 ? CALL_VIDEO_CONSTRAINED_BASELINE : CALL_VIDEO_MAIN)};
bool bothOrientations = true;
for (int portrait = 0; portrait <= 1 && bothOrientations && m->running; ++portrait) {
probe.width = portrait ? 720 : 1280; probe.height = portrait ? 1280 : 720;
CallVideoEncoder encoder;
bothOrientations = encoder.open(probe, 1000000);
if (!bothOrientations) DEBUG_WARN(DEBUG_CATEGORY_CALL, "call codec probe unavailable codec=%u size=%ux%u: %s",
codec, probe.width, probe.height, qPrintable(encoder.error()));
}
if (bothOrientations && m->running) {
call_video_limit limit{1280, 720, 30, 1280 * 720 * 30, 4000000, probe.profile, probe.level};
if (!call_video_limit_orientations(&limit, codec)) caps.encode[codec - 1] = limit;
for (const QSize size : {QSize(1920, 1080), QSize(1280, 720)}) {
const bool fullhd = size.width() == 1920;
call_video_format probe{1, (uint16_t)size.width(), (uint16_t)size.height(), 30, 0, (uint8_t)codec,
(uint8_t)(codec == 1 ? (fullhd ? 40 : 31) : (fullhd ? 120 : 93)), 4000000,
(uint8_t)(codec == 1 ? CALL_VIDEO_CONSTRAINED_BASELINE : CALL_VIDEO_MAIN)};
bool bothOrientations = true;
for (int portrait = 0; portrait <= 1 && bothOrientations && m->running; ++portrait) {
probe.width = portrait ? size.height() : size.width(); probe.height = portrait ? size.width() : size.height();
CallVideoEncoder encoder;
bothOrientations = encoder.open(probe, 1000000);
if (!bothOrientations) DEBUG_WARN(DEBUG_CATEGORY_CALL, "call codec probe unavailable codec=%u size=%ux%u: %s",
codec, probe.width, probe.height, qPrintable(encoder.error()));
}
if (bothOrientations && m->running) {
call_video_limit limit{(uint16_t)size.width(), (uint16_t)size.height(), 30,
(uint32_t)(size.width() * size.height() * 30), 4000000, probe.profile, probe.level};
if (!call_video_limit_orientations(&limit, codec)) caps.encode[codec - 1] = limit;
break;
}
}
}
if (!m->running) return;