From 1b85406b139db5ea57829e53c5ecd919a9b694fa Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 14 Oct 2026 11:21:11 +0200 Subject: [PATCH] Trace encoder responses to explicit random access frame requests --- tools/chatgui/src/stream_video_encoder.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/src/stream_video_encoder.cpp b/tools/chatgui/src/stream_video_encoder.cpp index 74b708da..277f28b3 100644 --- a/tools/chatgui/src/stream_video_encoder.cpp +++ b/tools/chatgui/src/stream_video_encoder.cpp @@ -204,6 +204,8 @@ bool StreamVideoEncoder::encode(const QImage& image, uint64_t pts, bool key, QLi } StreamEncodedFrame encoded; encoded.key = (packet->flags & AV_PKT_FLAG_KEY) != 0; encoded.pts = packet->pts >= 0 ? static_cast(packet->pts) : pts; + if (key) DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "desktop requested KEY name=%s input_PTS=%llu output_PTS=%llu key=%d flags=%x bytes=%d", + qPrintable(m->name), (unsigned long long)pts, (unsigned long long)encoded.pts, encoded.key, packet->flags, packet->size); if (encoded.key) { const uint8_t* config = m->filter ? m->filter->par_out->extradata : m->codec->extradata; int length = m->filter ? m->filter->par_out->extradata_size : m->codec->extradata_size; @@ -216,7 +218,11 @@ bool StreamVideoEncoder::encode(const QImage& image, uint64_t pts, bool key, QLi output.push_back(std::move(encoded)); av_packet_unref(packet); } av_packet_free(&packet); - if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) return true; + if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) { + if (key && output.isEmpty()) DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "desktop requested KEY buffered name=%s PTS=%llu", + qPrintable(m->name), (unsigned long long)pts); + return true; + } if (result < 0) { m->error = ffError(result); DEBUG_ERROR(DEBUG_CATEGORY_VIDEO, "desktop encode failed name=%s PTS=%llu: %s", qPrintable(m->name), (unsigned long long)pts, qPrintable(m->error)); return false; } return true;