Route desktop codec diagnostics through the shared log

Quiet capability probes, preserve runtime errors, and register the desktop portal application. Add logging and desktop launcher regression coverage.
This commit is contained in:
evgeny committed 2026-10-21 15:45:40 +02:00
1 parent 9ba78c084b
commit 7c814f5cb9
17 files changed
+349 -44

No files matched your search

+35
View File
@@ -38,6 +38,34 @@ static void vc_active_set(int v) { __atomic_store_n(&g_transcode_active, v, __
int video_transcode_get_progress(void) { return vc_progress_get(); }
int video_transcode_is_active(void) { return vc_active_get(); }
/* Пробы не меняют глобальный уровень: параллельные звонки сохраняют рабочие ошибки. */
#ifdef _MSC_VER
static __declspec(thread) struct { unsigned depth, repeated; char last[1024]; } g_codec_probe;
#else
static __thread struct { unsigned depth, repeated; char last[1024]; } g_codec_probe;
#endif
static void video_codec_probe_flush(void) {
if (g_codec_probe.repeated)
DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "ffmpeg probe: repeated=%u message=%s", g_codec_probe.repeated, g_codec_probe.last);
g_codec_probe.repeated = 0;
}
void video_codec_probe_begin(void) {
video_ffmpeg_init();
++g_codec_probe.depth;
}
void video_codec_probe_end(void) {
if (!g_codec_probe.depth) { DEBUG_ERROR(DEBUG_CATEGORY_VIDEO, "video codec probe end without begin"); return; }
if (--g_codec_probe.depth) return;
video_codec_probe_flush(); g_codec_probe.last[0] = '\0';
}
int video_codec_log_level(int level) {
return g_codec_probe.depth && level >= DEBUG_LEVEL_ERROR && level < DEBUG_LEVEL_DEBUG ? DEBUG_LEVEL_DEBUG : level;
}
#ifndef HAVE_FFMPEG
/* ─── сборка без ffmpeg: стабы ─── */
@@ -92,6 +120,13 @@ static void video_av_log_cb(void* avcl, int level, const char* fmt, va_list vl)
vsnprintf(buf, sizeof(buf), fmt, vl);
size_t len = strlen(buf);
while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r')) buf[--len] = '\0';
if (!len) return;
if (g_codec_probe.depth && level <= AV_LOG_WARNING) {
if (!strcmp(g_codec_probe.last, buf)) { ++g_codec_probe.repeated; return; }
video_codec_probe_flush(); snprintf(g_codec_probe.last, sizeof(g_codec_probe.last), "%s", buf);
DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "ffmpeg probe source=%s level=%d: %s", avcl ? av_default_item_name(avcl) : "none", level, buf);
return;
}
if (headers) {
if (!strstr(buf, "Packet:") && !strstr(buf, "init_qp_minus26") && !strstr(buf, "slice_qp_delta")
&& !strstr(buf, "pic_width_in_luma_samples") && !strstr(buf, "pic_height_in_luma_samples")
+7
View File
@@ -14,6 +14,13 @@ struct UASYNC;
* trace категории debug включает AMF и заголовки HEVC. В сборке без FFmpeg ничего не делает. */
void video_ffmpeg_init(void);
/* Проба доступности codec: begin/end парные, вложенные, только для текущего потока.
* Ожидаемые отказы FFmpeg выводятся на debug с подсчётом повторов; рабочие потоки не затрагиваются. */
void video_codec_probe_begin(void);
void video_codec_probe_end(void);
/* Возвращает debug вместо error/warn/info внутри пробы; level — DEBUG_LEVEL_* из debug_config.h. */
int video_codec_log_level(int level);
/* ── целевой профиль: H.264 в MP4, не более 720p / 2 Mbit ── */
#define VIDEO_TARGET_MAX_WIDTH 1280