Fix double stops
This commit is contained in:
@@ -62,8 +62,11 @@ namespace ANSCENTER {
|
||||
}
|
||||
clientToClose = std::move(_playerClient);
|
||||
}
|
||||
// reset() runs the destructor which calls close() exactly once.
|
||||
// Do NOT call close() explicitly before reset() — second close would
|
||||
// re-enter decoder Stop/flush on already-torn-down state.
|
||||
if (clientToClose) {
|
||||
clientToClose->close();
|
||||
clientToClose.reset();
|
||||
}
|
||||
}
|
||||
static void VerifyGlobalANSFLVLicense(const std::string& licenseKey) {
|
||||
@@ -144,7 +147,8 @@ namespace ANSCENTER {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_isPlaying = false;
|
||||
}
|
||||
_playerClient->close();
|
||||
// CHttpFlvPlayer::open() calls close() internally at the top —
|
||||
// no need to close explicitly (would be a double-close).
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
Setup();
|
||||
_isPlaying = _playerClient->play();
|
||||
|
||||
@@ -59,8 +59,11 @@ namespace ANSCENTER {
|
||||
}
|
||||
clientToClose = std::move(_playerClient);
|
||||
}
|
||||
// reset() runs the destructor which calls close() exactly once.
|
||||
// Do NOT call close() explicitly before reset() — second close would
|
||||
// re-enter decoder Stop/flush on already-torn-down state.
|
||||
if (clientToClose) {
|
||||
clientToClose->close();
|
||||
clientToClose.reset();
|
||||
}
|
||||
}
|
||||
static void VerifyGlobalANSMJPEGLicense(const std::string& licenseKey) {
|
||||
@@ -141,7 +144,8 @@ namespace ANSCENTER {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_isPlaying = false;
|
||||
}
|
||||
_playerClient->close();
|
||||
// CHttpMjpegPlayer::open() calls close() internally at the top —
|
||||
// no need to close explicitly (would be a double-close).
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
Setup();
|
||||
_isPlaying = _playerClient->play();
|
||||
|
||||
@@ -61,8 +61,11 @@ namespace ANSCENTER {
|
||||
}
|
||||
clientToClose = std::move(_playerClient);
|
||||
}
|
||||
// reset() runs the destructor which calls close() exactly once.
|
||||
// Do NOT call close() explicitly before reset() — second close would
|
||||
// re-enter decoder Stop/flush on already-torn-down state.
|
||||
if (clientToClose) {
|
||||
clientToClose->close();
|
||||
clientToClose.reset();
|
||||
}
|
||||
}
|
||||
static void VerifyGlobalANSRTMPLicense(const std::string& licenseKey) {
|
||||
@@ -138,7 +141,8 @@ namespace ANSCENTER {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_isPlaying = false;
|
||||
}
|
||||
_playerClient->close();
|
||||
// CRtmpPlayer::open() calls close() internally at the top —
|
||||
// no need to close explicitly (would be a double-close).
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
Setup();
|
||||
_isPlaying = _playerClient->play();
|
||||
|
||||
@@ -128,8 +128,11 @@ namespace ANSCENTER {
|
||||
// close() destroys the NVDEC decoder ONLY. Pool slot buffers
|
||||
// (regular cudaMallocPitch allocations) are untouched — they
|
||||
// belong to the global GpuNV12SlotPool, not the decoder.
|
||||
// reset() runs ~CRtspPlayer which calls close() exactly once —
|
||||
// do NOT call close() explicitly here (the destructor would call
|
||||
// it again, which re-enters torn-down decoder state).
|
||||
if (clientToClose) {
|
||||
clientToClose->close();
|
||||
clientToClose.reset();
|
||||
|
||||
// Force CUDA runtime to release all cached memory from the destroyed
|
||||
// NVDEC decoder. Without this, cuMemFree returns memory to the CUDA
|
||||
|
||||
@@ -61,8 +61,11 @@ namespace ANSCENTER {
|
||||
}
|
||||
clientToClose = std::move(_playerClient);
|
||||
}
|
||||
// reset() runs the destructor which calls close() exactly once.
|
||||
// Do NOT call close() explicitly before reset() — second close would
|
||||
// re-enter decoder Stop/flush on already-torn-down state.
|
||||
if (clientToClose) {
|
||||
clientToClose->close();
|
||||
clientToClose.reset();
|
||||
}
|
||||
}
|
||||
static void VerifyGlobalANSSRTLicense(const std::string& licenseKey) {
|
||||
@@ -136,7 +139,8 @@ namespace ANSCENTER {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
_isPlaying = false;
|
||||
}
|
||||
_playerClient->close();
|
||||
// CSrtPlayer::open() calls close() internally at the top —
|
||||
// no need to close explicitly (would be a double-close).
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
Setup();
|
||||
_isPlaying = _playerClient->play();
|
||||
|
||||
Reference in New Issue
Block a user