Fix NV12 crash issue when recreate camera object
This commit is contained in:
@@ -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__);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user