From f6cba98a8ed7a9adedf85162e34265eb92c31838 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Mon, 6 Feb 2023 14:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DFrameDispatcher=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E6=AD=BB=E9=94=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Extension/Frame.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 7af363c4..c7e301ec 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 7af363c4015a63fa48079af2cb08da2ceb1f69e6 +Subproject commit c7e301ec82fa6feb117e824ff522acd8a740cc9e diff --git a/src/Extension/Frame.h b/src/Extension/Frame.h index 6060c355..2ba0c94e 100644 --- a/src/Extension/Frame.h +++ b/src/Extension/Frame.h @@ -292,7 +292,7 @@ public: * 添加代理 */ FrameWriterInterface* addDelegate(FrameWriterInterface::Ptr delegate) { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); return _delegates.emplace(delegate.get(), std::move(delegate)).first->second.get(); } @@ -302,7 +302,7 @@ public: * 删除代理 */ void delDelegate(FrameWriterInterface *ptr) { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); _delegates.erase(ptr); } @@ -310,7 +310,7 @@ public: * 写入帧并派发 */ bool inputFrame(const Frame::Ptr &frame) override { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); ++_frames; if (frame->keyFrame() && frame->getTrackType() == TrackVideo) { ++_video_key_frames; @@ -328,12 +328,12 @@ public: * 返回代理个数 */ size_t size() const { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); return _delegates.size(); } void clear() { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); _delegates.clear(); } @@ -341,7 +341,7 @@ public: * 获取累计关键帧数 */ uint64_t getVideoKeyFrames() const { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); return _video_key_frames; } @@ -349,14 +349,14 @@ public: * 获取帧数 */ uint64_t getFrames() const { - std::lock_guard lck(_mtx); + std::lock_guard lck(_mtx); return _frames; } private: uint64_t _frames = 0; uint64_t _video_key_frames = 0; - mutable std::mutex _mtx; + mutable std::recursive_mutex _mtx; std::map _delegates; };