Fix NV12 crash issue when recreate camera object

This commit is contained in:
2026-04-02 22:07:27 +11:00
parent 4bedf3a3a2
commit 958cab6ae3
25 changed files with 1459 additions and 393 deletions

View File

@@ -575,8 +575,13 @@ void CVideoDecoder::Start() {
}
void CVideoDecoder::Stop() {
std::lock_guard<std::recursive_mutex> lock(_mutex);
m_bRunning = FALSE;
// Atomically signal the decoder to stop WITHOUT acquiring _mutex.
// decode() holds _mutex while inside avcodec_send_packet / CUDA calls
// that can block on the nvcuda64 SRW lock for a long time.
// If we waited for _mutex here, Stop() would deadlock whenever a
// concurrent decode() is stuck waiting for a CUDA operation held by
// an inference thread.
m_bRunning.store(FALSE, std::memory_order_release);
log_print(HT_LOG_INFO, "%s, Video decoder stopped\r\n", __FUNCTION__);
}