From 3f1386db26fc1d8d7b615907d21d0f196780eda2 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期五, 22 十一月 2019 11:14:40 +0800
Subject: [PATCH] update
---
csrc/thirdparty/gb28181/include/PsToEs.hpp | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/csrc/thirdparty/gb28181/include/PsToEs.hpp b/csrc/thirdparty/gb28181/include/PsToEs.hpp
index df0c2ed..30a1903 100644
--- a/csrc/thirdparty/gb28181/include/PsToEs.hpp
+++ b/csrc/thirdparty/gb28181/include/PsToEs.hpp
@@ -42,7 +42,7 @@
pthread_mutex_lock(&mtx);
if (q.empty()) {
gettimeofday(&now, NULL);
- t.tv_sec = now.tv_sec + 5;
+ t.tv_sec = now.tv_sec + 3;
t.tv_nsec = now.tv_usec * 1000;
// pthread_cond_wait(&cond, &mtx);
pthread_cond_timedwait(&cond, &mtx, &t);
@@ -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