From 4587f8d5507300782e329f9527f35f905f3bb697 Mon Sep 17 00:00:00 2001 From: chenshijun <csj_sky@126.com> Date: 星期二, 29 十月 2019 14:13:25 +0800 Subject: [PATCH] Merge branch 'master' of ssh://192.168.5.5:29418/valib/goffmpeg --- csrc/thirdparty/gb28181/include/PsToEs.hpp | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/csrc/thirdparty/gb28181/include/PsToEs.hpp b/csrc/thirdparty/gb28181/include/PsToEs.hpp index df0c2ed..4c10a28 100644 --- a/csrc/thirdparty/gb28181/include/PsToEs.hpp +++ b/csrc/thirdparty/gb28181/include/PsToEs.hpp @@ -75,6 +75,16 @@ while (!q.empty()) q.pop_front(); pthread_mutex_unlock(&mtx); } + + void clearAll(std::function<void(T)> fn){ + pthread_mutex_lock(&mtx); + while (!q.empty()){ + T value = q.front(); + fn(value); + q.pop_front(); + } + pthread_mutex_unlock(&mtx); + } private: deque<T> q; pthread_mutex_t mtx; @@ -96,7 +106,11 @@ ~GB28181API(){ printf("GB28181API end!\n"); - m_rtpQueue.clearAll(); + // m_rtpQueue.clearAll(); + m_rtpQueue.clearAll([](frameBuffInfo *info){ + delete[] info->buff; + delete info; + }); deleteCamera(); } -- Gitblit v1.8.0