Improve ANSCV

This commit is contained in:
2026-04-21 09:26:02 +10:00
parent 9f0a10a4c8
commit 7e772f76bc
15 changed files with 749 additions and 421 deletions

View File

@@ -332,8 +332,28 @@ void CVideoDecoder::uninit()
{
std::lock_guard<std::recursive_mutex> lock(_mutex);
// [MEDIA_DecClose] heartbeat — paired with [MEDIA_DecInit] for leak diagnosis.
// Pair count over a long run reveals whether avcodec_open2 calls are
// matched by full teardowns. If close-count < init-count, the FFmpeg
// codec context (and its custom get_buffer2 arena) is leaking per reopen.
{
static std::atomic<uint64_t> s_closeCount{0};
const uint64_t n = s_closeCount.fetch_add(1) + 1;
ANS_DBG("MEDIA_DecClose",
"uninit ENTRY #%llu inited=%d codec=%s %dx%d hwEnabled=%d cudaHW=%d gpu=%d (this=%p)",
(unsigned long long)n,
(int)m_bInited,
(m_pCodec && m_pCodec->name) ? m_pCodec->name : "?",
m_pContext ? m_pContext->width : 0,
m_pContext ? m_pContext->height : 0,
(int)m_bHardwareDecoderEnabled,
(int)m_bCudaHWAccel,
m_hwGpuIndex,
(void*)this);
}
// Stop processing first
// Backup first
// Backup first
BOOL wasRunning = m_bRunning;
m_bRunning = FALSE;