Устранить сжатие панели звонка и распараллелить HEVC внутри кадра

This commit is contained in:
evgeny committed 2026-10-18 16:28:36 +02:00
1 parent 21e4821e22
commit 3ed9acb384
2 files changed
+14 -3

No files matched your search

+8 -2
View File
@@ -191,7 +191,6 @@ CallWindow::CallWindow(QWidget* parent)
: QWidget(parent, Qt::Window) { : QWidget(parent, Qt::Window) {
setWindowTitle(QCoreApplication::translate("ChatGui", "Call")); setWindowTitle(QCoreApplication::translate("ChatGui", "Call"));
resize(520, 520); resize(520, 520);
setMinimumSize(420, 360);
setAttribute(Qt::WA_DeleteOnClose, false); setAttribute(Qt::WA_DeleteOnClose, false);
m_avatarLabel = new QLabel(this); m_avatarLabel = new QLabel(this);
@@ -244,10 +243,14 @@ CallWindow::CallWindow(QWidget* parent)
auto* root = new QVBoxLayout(this); auto* root = new QVBoxLayout(this);
root->setContentsMargins(12, 12, 12, 12); root->setContentsMargins(12, 12, 12, 12);
root->setSizeConstraint(QLayout::SetMinimumSize);
m_videoWindow = new CallVideoWindow(this); m_videoWindow = new CallVideoWindow(this);
m_panel = new QWidget(this); m_panel->setObjectName("callPanel"); m_panel->setMaximumWidth(640); m_panel = new QWidget(this); m_panel->setObjectName("callPanel"); m_panel->setMaximumWidth(640);
m_panel->setStyleSheet("QWidget#callPanel { background: palette(window); border-radius: 12px; }"); m_panel->setStyleSheet("QWidget#callPanel { background: palette(window); border-radius: 12px; }");
root->addWidget(m_panel, 0, Qt::AlignCenter); // Вертикальное центрирование через отступы сохраняет минимальную высоту панели в расчёте размера окна.
root->addStretch(1);
root->addWidget(m_panel, 0, Qt::AlignHCenter);
root->addStretch(1);
QVBoxLayout* lay = new QVBoxLayout(m_panel); QVBoxLayout* lay = new QVBoxLayout(m_panel);
lay->setContentsMargins(16, 20, 16, 16); lay->setContentsMargins(16, 20, 16, 16);
lay->setSpacing(8); lay->setSpacing(8);
@@ -457,6 +460,9 @@ void CallWindow::updateVideoPresentation() {
m_videoEnabled->setVisible(active); m_settingsBtn->setVisible(active); m_videoEnabled->setVisible(active); m_settingsBtn->setVisible(active);
m_videoControls->setVisible(settings); m_showVideoBtn->setVisible(receiving); m_videoControls->setVisible(settings); m_showVideoBtn->setVisible(receiving);
m_videoStatus->setVisible(active && !m_videoStatus->text().isEmpty()); m_videoStatus->setVisible(active && !m_videoStatus->text().isEmpty());
QSize panelMinimum = m_panel->minimumSizeHint();
DEBUG_DEBUG(DEBUG_CATEGORY_CALL, "call layout active=%d preview=%d settings=%d window=%dx%d panel_min=%dx%d",
active, m_localPreview->isVisible(), settings, width(), height(), panelMinimum.width(), panelMinimum.height());
update(); update();
} }
+6 -1
View File
@@ -10,6 +10,7 @@ extern "C" {
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavcodec/bsf.h> #include <libavcodec/bsf.h>
#include <libavutil/hwcontext.h> #include <libavutil/hwcontext.h>
#include <libavutil/cpu.h>
#include <libavutil/opt.h> #include <libavutil/opt.h>
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
#endif #endif
@@ -169,8 +170,12 @@ bool LiveVideoEncoder::open(const LiveVideoConfig& config, Backend backend) {
if (name == "libx264" || name == "libx265") { if (name == "libx264" || name == "libx265") {
av_dict_set(&options, "preset", "ultrafast", 0); av_dict_set(&options, "tune", "zerolatency", 0); av_dict_set(&options, "preset", "ultrafast", 0); av_dict_set(&options, "tune", "zerolatency", 0);
av_dict_set(&options, "forced-idr", "1", 0); av_dict_set(&options, "forced-idr", "1", 0);
const int workers = std::clamp(av_cpu_count(), 1, 4);
QByteArray params = name == "libx264" ? "scenecut=0:open-gop=0:repeat-headers=0" QByteArray params = name == "libx264" ? "scenecut=0:open-gop=0:repeat-headers=0"
: "bframes=0:rc-lookahead=0:open-gop=0:pools=1:frame-threads=1:log-level=error"; : "bframes=0:rc-lookahead=0:open-gop=0:frame-threads=1:wpp=1:log-level=error:pools=" + QByteArray::number(workers);
if (name == "libx265")
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "live HEVC parallelism workers=%d frame_threads=1 wpp=1 cpu_count=%d",
workers, av_cpu_count());
if (constrained) { if (constrained) {
c->thread_count = 1; c->thread_count = 1;
av_dict_set(&options, "profile", name == "libx264" ? "baseline" : "main", 0); av_dict_set(&options, "profile", name == "libx264" ? "baseline" : "main", 0);