Commit 940c81797b2f040b70cc11f5d117018102d11b8d

Authored by Hu Chunming
1 parent 682bbe39

代码优化

test/main.cpp
... ... @@ -114,7 +114,7 @@ void init_mq_conn(void *handle) {
114 114 }
115 115 #endif
116 116  
117   -const char* ipc_url = "/home/cmhu/tongtu/tsl_aiplatform_project_with_screenshot/data/duan1.avi";
  117 +const char* ipc_url = "/data/cmhu/data2/duan1.avi";
118 118  
119 119 void set_ipc_url(task_param &tparam, const algorithm_type_t &algor_type) {
120 120  
... ...
tsl_aiplatform/ai_platform/MultiSourceProcess.cpp
... ... @@ -1280,6 +1280,7 @@ void CMultiSourceProcess::CloseAllTask(){
1280 1280  
1281 1281 pthread_join(m_gpuProcessthread,0);
1282 1282  
  1283 + // 待解码线程和算法处理线程都结束后再清理数据队列
1283 1284 m_QueueMtx.lock();
1284 1285 for (auto iter = m_RgbDataList.begin(); iter!=m_RgbDataList.end(); ){
1285 1286 GpuRgbMemory* gpuMem = *iter;
... ...
tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.cpp
... ... @@ -34,12 +34,16 @@ save_snapshot_reprocessing::save_snapshot_reprocessing() {
34 34 _snapshot_reprocessing = snapshot_reprocessing::getInstance();
35 35 _task_param_manager = task_param_manager::getInstance();
36 36  
  37 + bFinish = false;
37 38 auto m_save_ss_thread = std::thread(save_image_thread_process, this);
38 39 m_save_ss_thread.detach();
39 40 }
40 41  
41 42 // 释放资源
42 43 void save_snapshot_reprocessing::save_snapshot_reprocessing_release() {
  44 + // 结束线程
  45 + bFinish = true;
  46 +
43 47 std::unique_lock<std::mutex> l(waitforsave_image_queue_mutex);
44 48  
45 49 while (!waitforsave_image_queue.empty()) {
... ... @@ -322,6 +326,10 @@ DWORD save_image_thread_process(LPVOID param) {
322 326 save_snapshot_reprocessing *pThreadParam = (save_snapshot_reprocessing *)param;
323 327  
324 328 while (true) {
  329 + if (bFinish){
  330 + break;
  331 + }
  332 +
325 333 std::unique_lock<std::mutex> l(pThreadParam->waitforsave_image_queue_mutex);
326 334 std::unique_lock<std::mutex> l_taskid(pThreadParam->waitforchange_taskid_mutex);
327 335 if (!pThreadParam->waitforsave_image_queue.empty()) {
... ...
tsl_aiplatform/reprocessing_module/save_snapshot_reprocessing.h
... ... @@ -82,6 +82,8 @@ public:
82 82 // map<OBJ_KEY, int> save_snapshot_info_count; // debug by zsh
83 83 mutable std::mutex waitforchange_taskid_mutex;
84 84  
  85 + bool bFinish{false};
  86 +
85 87 #ifdef POST_USE_RABBITMQ
86 88 callback_t callback_;
87 89 std::shared_ptr<mq::post_rabbitmq_reprocessing> rbmq_handler_;
... ...