video_decoder: console visibility for keyframe gate arm/release

log_print writes to the sys_log file (unopened in unit tests / field
debugging), so the gate looked inert next to FFmpeg's stderr error lines.
Emit arm/release one-liners to stderr alongside them.

Live verification during a severe Wi-Fi loss burst (271 HEVC errors /
3 min, NVDEC path): gate armed 19x, released 17x, dropping 29-118
corrupt frames per burst and resuming on the next clean keyframe.
The av_log bridge (273dd44) is confirmed working end-to-end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 05:40:34 +10:00
co-authored by Claude Fable 5
parent 273dd44a6d
commit b341392e0f
+8
View File
@@ -1185,6 +1185,10 @@ BOOL CVideoDecoder::readFrame()
log_print(HT_LOG_WARN,
"%s, corrupt frame (decode_error_flags=0x%x) -- gating until next keyframe\r\n",
__FUNCTION__, m_pFrame->decode_error_flags);
// Also to stderr so it appears next to FFmpeg's own [hevc @ ...]
// error lines (log_print goes to the log file, which unit tests
// and field debugging sessions usually don't have open).
fprintf(stderr, "[MediaClient] corrupt frame detected -- gating until next keyframe\n");
ANS_DBG("MEDIA_Decode",
"corrupt frame (decode_error_flags=0x%x) — re-arming keyframe gate",
m_pFrame->decode_error_flags);
@@ -1231,6 +1235,10 @@ BOOL CVideoDecoder::readFrame()
ANS_DBG("MEDIA_Decode",
"keyframe acquired after %d dropped frame(s) — resuming output",
m_nKeyframeWaitCount);
if (m_nKeyframeWaitCount > 0) {
fprintf(stderr, "[MediaClient] keyframe acquired after %d dropped frame(s) -- resuming\n",
m_nKeyframeWaitCount);
}
} else if (++m_nKeyframeWaitCount >= 300) {
m_bWaitKeyframe.store(false, std::memory_order_relaxed);
ANS_DBG("MEDIA_Decode",