From a51af917188161b3bc8d79fadf72c9d24e2986b9 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sun, 18 Oct 2026 21:51:54 +0200 Subject: [PATCH] Use AMF remote desktop latency mode for HEVC broadcasts --- tools/chatgui/src/live_video_encoder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/chatgui/src/live_video_encoder.cpp b/tools/chatgui/src/live_video_encoder.cpp index 515e7f69..916d0f4f 100644 --- a/tools/chatgui/src/live_video_encoder.cpp +++ b/tools/chatgui/src/live_video_encoder.cpp @@ -221,7 +221,9 @@ bool LiveVideoEncoder::open(const LiveVideoConfig& config, Backend backend) { if (config.codec == STREAM_MEDIA_H265) av_dict_set(&options, "tier", "main", 0); } } else if (name.endsWith("_amf")) { - av_dict_set(&options, "usage", "ultralowlatency", 0); + // Для трансляции HEVC используем режим remote desktop; профиль звонков сохраняет ultra-low latency. + const char* usage = !constrained && config.codec == STREAM_MEDIA_H265 ? "lowlatency" : "ultralowlatency"; + av_dict_set(&options, "usage", usage, 0); av_dict_set(&options, "quality", "speed", 0); bool asyncDepth = av_opt_find(c->priv_data, "async_depth", nullptr, 0, 0); if (asyncDepth) av_dict_set(&options, "async_depth", "1", 0); @@ -235,8 +237,8 @@ bool LiveVideoEncoder::open(const LiveVideoConfig& config, Backend backend) { if (config.codec == STREAM_MEDIA_H265) av_dict_set(&options, "profile_tier", "main", 0); } DEBUG_INFO(DEBUG_CATEGORY_VIDEO, - "desktop AMF low latency settings name=%s usage=ultralowlatency quality=speed async_depth=%s forced_idr=%d", - name.constData(), asyncDepth ? "1" : "driver", m->forcedKeys); + "desktop AMF low latency settings name=%s usage=%s quality=speed async_depth=%s forced_idr=%d", + name.constData(), usage, asyncDepth ? "1" : "driver", m->forcedKeys); } else if (name == "libvpx-vp9" || name == "libaom-av1") { av_dict_set(&options, "deadline", "realtime", 0); av_dict_set(&options, "cpu-used", "8", 0); av_dict_set(&options, "lag-in-frames", "0", 0); av_dict_set(&options, "row-mt", "1", 0);