diff --git a/server/VideoStack.cpp b/server/VideoStack.cpp index 76b5ad49..bfa9bb1f 100644 --- a/server/VideoStack.cpp +++ b/server/VideoStack.cpp @@ -23,7 +23,11 @@ INSTANCE_IMP(VideoStackManager) -Param::~Param() { VideoStackManager::Instance().unrefChannel(id, width, height, pixfmt); } +Param::~Param() { + auto strongChn= weak_chn.lock(); + if (!strongChn) { return; } + VideoStackManager::Instance().unrefChannel(id, width, height, pixfmt); +} Channel::Channel(const std::string& id, int width, int height, AVPixelFormat pixfmt) : _id(id), _width(width), _height(height), _pixfmt(pixfmt) {