Fix double stop in ANSVideoPlayer

This commit is contained in:
2026-04-22 10:10:16 +10:00
parent 97d814936d
commit 57cc8e0a56
14 changed files with 492 additions and 70 deletions

View File

@@ -22,10 +22,17 @@
// Defined in video_player.cpp; also incremented from FrameQueue here.
extern std::atomic<int64_t> g_queueClones; // av_frame_clone from FrameQueue
extern std::atomic<int64_t> g_queueFrees; // av_frame_free from FrameQueue
extern std::atomic<int64_t> g_nv12Clones; // m_currentNV12Frame = av_frame_clone
extern std::atomic<int64_t> g_nv12Frees; // av_frame_free(&m_currentNV12Frame)
extern std::atomic<int64_t> g_cudaHWClones; // m_currentCudaHWFrame = clone
extern std::atomic<int64_t> g_cudaHWFrees; // av_frame_free(&m_currentCudaHWFrame)
extern std::atomic<int64_t> g_nv12Clones; // m_currentNV12Frame = av_frame_clone (INTERNAL replace-on-update)
extern std::atomic<int64_t> g_nv12Frees; // av_frame_free(&m_currentNV12Frame) (INTERNAL)
extern std::atomic<int64_t> g_nv12Escapes; // getNV12Frame() clones handed to callers (EXTERNAL — should be balanced by caller's av_frame_free)
extern std::atomic<int64_t> g_cudaHWClones; // m_currentCudaHWFrame = clone (INTERNAL)
extern std::atomic<int64_t> g_cudaHWFrees; // av_frame_free(&m_currentCudaHWFrame) (INTERNAL)
extern std::atomic<int64_t> g_cudaHWEscapes; // getCudaHWFrame() clones handed to callers (EXTERNAL)
// Inbound side: AVFrames pushed to pendingFree (drained by gpu_frame_evict_stale).
// Incremented in ANSGpuFrameRegistry::pushPendingFree_locked — counts AVFrames that
// callers relinquished back to the media layer for deferred freeing. If escapes grow
// faster than pendingReturns, the escape path is leaking.
extern std::atomic<int64_t> g_avframePendingReturns;
typedef struct
{