diff --git a/tools/chatgui/src/callwindow.cpp b/tools/chatgui/src/callwindow.cpp index a5791391..e5f0e04c 100644 --- a/tools/chatgui/src/callwindow.cpp +++ b/tools/chatgui/src/callwindow.cpp @@ -191,7 +191,6 @@ CallWindow::CallWindow(QWidget* parent) : QWidget(parent, Qt::Window) { setWindowTitle(QCoreApplication::translate("ChatGui", "Call")); resize(520, 520); - setMinimumSize(420, 360); setAttribute(Qt::WA_DeleteOnClose, false); m_avatarLabel = new QLabel(this); @@ -244,10 +243,14 @@ CallWindow::CallWindow(QWidget* parent) auto* root = new QVBoxLayout(this); root->setContentsMargins(12, 12, 12, 12); + root->setSizeConstraint(QLayout::SetMinimumSize); m_videoWindow = new CallVideoWindow(this); m_panel = new QWidget(this); m_panel->setObjectName("callPanel"); m_panel->setMaximumWidth(640); 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); lay->setContentsMargins(16, 20, 16, 16); lay->setSpacing(8); @@ -457,6 +460,9 @@ void CallWindow::updateVideoPresentation() { m_videoEnabled->setVisible(active); m_settingsBtn->setVisible(active); m_videoControls->setVisible(settings); m_showVideoBtn->setVisible(receiving); 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(); } diff --git a/tools/chatgui/src/live_video_encoder.cpp b/tools/chatgui/src/live_video_encoder.cpp index 13f2cc68..dfa91a79 100644 --- a/tools/chatgui/src/live_video_encoder.cpp +++ b/tools/chatgui/src/live_video_encoder.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include #include +#include #include #include #endif @@ -169,8 +170,12 @@ bool LiveVideoEncoder::open(const LiveVideoConfig& config, Backend backend) { if (name == "libx264" || name == "libx265") { av_dict_set(&options, "preset", "ultrafast", 0); av_dict_set(&options, "tune", "zerolatency", 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" - : "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) { c->thread_count = 1; av_dict_set(&options, "profile", name == "libx264" ? "baseline" : "main", 0);