Commit 63494f362d34a917cd73ba10133a677900e414bf
Merge branch 'dev-cmhu' into 'master'
Dev cmhu recode添加close和mq消息发送 See merge request !2
Showing
23 changed files
with
196 additions
and
131 deletions
bin/logs/main_2023_08_10.log deleted
1 | -MultiSourceProcess.cpp(86): [I 08/10/23 15:01:27.944 4109495 4109495 InitAlgorthim] 编译时间:Aug 10 2023 14:48:49 | ||
2 | -VPTProcess.cpp(30): [I 08/10/23 15:01:28.839 4109495 4109495 init] vpt 版本:vpt_vdec_arm_310p_v0.0.2.20230613_without_timelimit 模型路径:./models/vpt230323_310p.om | ||
3 | -MultiSourceProcess.cpp(585): [I 08/10/23 15:01:29.145 4109495 4109723 algorthim_process_thread] algorthim_process_thread start... | ||
4 | -MultiSourceProcess.cpp(955): [I 08/10/23 15:01:29.146 4109495 4109725 timing_snapshot_thread] timing_snapshot_thread start. | ||
5 | -MultiSourceProcess.cpp(181): [I 08/10/23 15:01:29.146 4109495 4109495 InitAlgorthim] InitAlgorthim succeed ! | ||
6 | -MultiSourceProcess.cpp(190): [I 08/10/23 15:01:29.146 4109495 4109495 AddMqConn] 初始化MQ队列 | ||
7 | -MultiSourceProcess.cpp(202): [I 08/10/23 15:01:29.225 4109495 4109495 AddMqConn] 为报警类 绑定MQ回调 | ||
8 | -MultiSourceProcess.cpp(207): [I 08/10/23 15:01:29.225 4109495 4109495 AddMqConn] 为报警类 绑定MQ回调 成功! | ||
9 | -MultiSourceProcess.cpp(210): [I 08/10/23 15:01:29.225 4109495 4109495 AddMqConn] 初始化MQ队列成功! | ||
10 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:34.059 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
11 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:34.059 4109495 4109495 snapshot_task] snap in task | ||
12 | -DecoderManager.cpp(467): [E 08/10/23 15:01:34.059 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
13 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:34.059 4109495 4109495 snapshot_task] failed! | ||
14 | - | ||
15 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:34.059 4109495 4109495 snapshot_task] snap out task | ||
16 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:35.359 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
17 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:35.359 4109495 4109495 init_vdpp] []- Init device start... | ||
18 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:35.359 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
19 | -DecoderManager.cpp(509): [I 08/10/23 15:01:35.359 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
20 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:35.423 4109495 4109988 sendVdecEos] []- send eos | ||
21 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:35.460 4109495 4109989 doProcessReport] doProcessReport exit. | ||
22 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:35.461 4109495 4109988 decode_thread] []- decode thread exit. | ||
23 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:35.461 4109495 4109987 read_thread] []- read thread exit. | ||
24 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:35.471 4109495 4109495 snapshot_task] snap successed! | ||
25 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:35.471 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
26 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:35.471 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
27 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:35.472 4109495 4109495 snapshot_task] snap in task | ||
28 | -DecoderManager.cpp(467): [E 08/10/23 15:01:35.472 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
29 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:35.472 4109495 4109495 snapshot_task] failed! | ||
30 | - | ||
31 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:35.472 4109495 4109495 snapshot_task] snap out task | ||
32 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:36.985 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
33 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:36.985 4109495 4109495 init_vdpp] []- Init device start... | ||
34 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:36.986 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
35 | -DecoderManager.cpp(509): [I 08/10/23 15:01:36.986 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
36 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:37.043 4109495 4110068 sendVdecEos] []- send eos | ||
37 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:37.083 4109495 4110069 doProcessReport] doProcessReport exit. | ||
38 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:37.085 4109495 4110068 decode_thread] []- decode thread exit. | ||
39 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:37.085 4109495 4110067 read_thread] []- read thread exit. | ||
40 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:37.094 4109495 4109495 snapshot_task] snap successed! | ||
41 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:37.094 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
42 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:37.094 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
43 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:37.094 4109495 4109495 snapshot_task] snap in task | ||
44 | -DecoderManager.cpp(467): [E 08/10/23 15:01:37.094 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
45 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:37.094 4109495 4109495 snapshot_task] failed! | ||
46 | - | ||
47 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:37.094 4109495 4109495 snapshot_task] snap out task | ||
48 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:38.391 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
49 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:38.391 4109495 4109495 init_vdpp] []- Init device start... | ||
50 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:38.393 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
51 | -DecoderManager.cpp(509): [I 08/10/23 15:01:38.393 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
52 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:38.439 4109495 4110116 sendVdecEos] []- send eos | ||
53 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:38.475 4109495 4110117 doProcessReport] doProcessReport exit. | ||
54 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:38.477 4109495 4110116 decode_thread] []- decode thread exit. | ||
55 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:38.477 4109495 4110115 read_thread] []- read thread exit. | ||
56 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:38.490 4109495 4109495 snapshot_task] snap successed! | ||
57 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:38.491 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
58 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:38.491 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
59 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:38.491 4109495 4109495 snapshot_task] snap in task | ||
60 | -DecoderManager.cpp(467): [E 08/10/23 15:01:38.491 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
61 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:38.491 4109495 4109495 snapshot_task] failed! | ||
62 | - | ||
63 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:38.491 4109495 4109495 snapshot_task] snap out task | ||
64 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:39.817 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
65 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:39.817 4109495 4109495 init_vdpp] []- Init device start... | ||
66 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:39.818 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
67 | -DecoderManager.cpp(509): [I 08/10/23 15:01:39.818 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
68 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:39.883 4109495 4110159 sendVdecEos] []- send eos | ||
69 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:39.900 4109495 4110160 doProcessReport] doProcessReport exit. | ||
70 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:39.901 4109495 4110159 decode_thread] []- decode thread exit. | ||
71 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:39.901 4109495 4110158 read_thread] []- read thread exit. | ||
72 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:39.911 4109495 4109495 snapshot_task] snap successed! | ||
73 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:39.911 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
74 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:39.911 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
75 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:39.911 4109495 4109495 snapshot_task] snap in task | ||
76 | -DecoderManager.cpp(467): [E 08/10/23 15:01:39.911 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
77 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:39.911 4109495 4109495 snapshot_task] failed! | ||
78 | - | ||
79 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:39.911 4109495 4109495 snapshot_task] snap out task | ||
80 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:41.207 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
81 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:41.207 4109495 4109495 init_vdpp] []- Init device start... | ||
82 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:41.208 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
83 | -DecoderManager.cpp(509): [I 08/10/23 15:01:41.208 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
84 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:41.263 4109495 4110226 sendVdecEos] []- send eos | ||
85 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:41.308 4109495 4110227 doProcessReport] doProcessReport exit. | ||
86 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:41.309 4109495 4110226 decode_thread] []- decode thread exit. | ||
87 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:41.310 4109495 4110225 read_thread] []- read thread exit. | ||
88 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:41.319 4109495 4109495 snapshot_task] snap successed! | ||
89 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:41.319 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
90 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:41.319 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
91 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:41.319 4109495 4109495 snapshot_task] snap in task | ||
92 | -DecoderManager.cpp(467): [E 08/10/23 15:01:41.319 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
93 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:41.319 4109495 4109495 snapshot_task] failed! | ||
94 | - | ||
95 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:41.319 4109495 4109495 snapshot_task] snap out task | ||
96 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:42.606 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
97 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:42.606 4109495 4109495 init_vdpp] []- Init device start... | ||
98 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:42.606 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
99 | -DecoderManager.cpp(509): [I 08/10/23 15:01:42.607 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
100 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:42.671 4109495 4110277 sendVdecEos] []- send eos | ||
101 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:42.683 4109495 4110278 doProcessReport] doProcessReport exit. | ||
102 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:42.685 4109495 4110277 decode_thread] []- decode thread exit. | ||
103 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:42.685 4109495 4110276 read_thread] []- read thread exit. | ||
104 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:42.694 4109495 4109495 snapshot_task] snap successed! | ||
105 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:42.695 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success | ||
106 | -MultiSourceProcess.cpp(467): [I 08/10/23 15:01:42.695 4109495 4109495 SnapShot] begin SnapShot task: test_task_id_default | ||
107 | -MultiSourceProcess.cpp(430): [I 08/10/23 15:01:42.695 4109495 4109495 snapshot_task] snap in task | ||
108 | -DecoderManager.cpp(467): [E 08/10/23 15:01:42.695 4109495 4109495 snapshot_in_task] 没有找到name为test_task_id_default的解码器 | ||
109 | -MultiSourceProcess.cpp(462): [E 08/10/23 15:01:42.695 4109495 4109495 snapshot_task] failed! | ||
110 | - | ||
111 | -MultiSourceProcess.cpp(433): [I 08/10/23 15:01:42.695 4109495 4109495 snapshot_task] snap out task | ||
112 | -DvppDecoder.cpp(151): [I 08/10/23 15:01:44.031 4109495 4109495 init_FFmpeg] []- init ffmpeg success! input:rtsp://admin:ad123456@192.168.60.165:554/cam/realmonitor?channel=1&subtype=0 frame_width:1920 frame_height:1080 fps:25 | ||
113 | -DvppDecoder.cpp(165): [I 08/10/23 15:01:44.031 4109495 4109495 init_vdpp] []- Init device start... | ||
114 | -DvppDecoder.cpp(210): [I 08/10/23 15:01:44.032 4109495 4109495 init_vdpp] []- init vdpp success! device:0 channel:0 | ||
115 | -DecoderManager.cpp(509): [I 08/10/23 15:01:44.032 4109495 4109495 snapshot_out_task] snapshot 解码器初始化成功 | ||
116 | -DvppDecoder.cpp(852): [I 08/10/23 15:01:44.089 4109495 4110331 sendVdecEos] []- send eos | ||
117 | -DvppDecoder.cpp(474): [I 08/10/23 15:01:44.128 4109495 4110332 doProcessReport] doProcessReport exit. | ||
118 | -DvppDecoder.cpp(698): [I 08/10/23 15:01:44.129 4109495 4110331 decode_thread] []- decode thread exit. | ||
119 | -DvppDecoder.cpp(432): [I 08/10/23 15:01:44.129 4109495 4110330 read_thread] []- read thread exit. | ||
120 | -MultiSourceProcess.cpp(458): [I 08/10/23 15:01:44.139 4109495 4109495 snapshot_task] snap successed! | ||
121 | -MultiSourceProcess.cpp(496): [I 08/10/23 15:01:44.139 4109495 4109495 SnapShot] SnapShot task: test_task_id_default success |
bin/res/video_snapshot/test_task_id_default_snap_1691650894059.jpg deleted
610 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650895472.jpg deleted
615 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650897094.jpg deleted
619 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650898491.jpg deleted
633 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650899911.jpg deleted
634 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650901319.jpg deleted
632 KB
bin/res/video_snapshot/test_task_id_default_snap_1691650902695.jpg deleted
633 KB
src/ai_platform/MultiSourceProcess.cpp
@@ -156,11 +156,18 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | @@ -156,11 +156,18 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ | ||
156 | pVpcUtil->init(m_devId); | 156 | pVpcUtil->init(m_devId); |
157 | 157 | ||
158 | m_pAlgorthimThread = new thread([](void* arg) { | 158 | m_pAlgorthimThread = new thread([](void* arg) { |
159 | - CMultiSourceProcess* process = (CMultiSourceProcess*)arg ; | ||
160 | - process->algorthim_process_thread(); | ||
161 | - return (void*)0; | ||
162 | - } | ||
163 | - , this); | 159 | + CMultiSourceProcess* process = (CMultiSourceProcess*)arg ; |
160 | + process->algorthim_process_thread(); | ||
161 | + return (void*)0; | ||
162 | + } | ||
163 | + , this); | ||
164 | + | ||
165 | + m_recode_thread = new thread([](void* arg) { | ||
166 | + CMultiSourceProcess* process = (CMultiSourceProcess*)arg ; | ||
167 | + process->recode_thread(); | ||
168 | + return (void*)0; | ||
169 | + } | ||
170 | + , this); | ||
164 | 171 | ||
165 | m_timing_snapshot_thread = new std::thread( | 172 | m_timing_snapshot_thread = new std::thread( |
166 | [](void* arg) | 173 | [](void* arg) |
@@ -296,6 +303,10 @@ bool CMultiSourceProcess::AddTask(task_param _cur_task_param){ | @@ -296,6 +303,10 @@ bool CMultiSourceProcess::AddTask(task_param _cur_task_param){ | ||
296 | return false; | 303 | return false; |
297 | } | 304 | } |
298 | 305 | ||
306 | +#ifdef POST_USE_RABBITMQ | ||
307 | + pDecManager->set_mq_callback(config.name, std::bind(&mq::Manager::publish, mq_manager_, mq_type, std::placeholders::_1, true)); | ||
308 | +#endif | ||
309 | + | ||
299 | // 人车物跟踪 | 310 | // 人车物跟踪 |
300 | if (task_has_vpt_algor(task_id)) | 311 | if (task_has_vpt_algor(task_id)) |
301 | vpt_process.addTaskTracker(task_id, 1, 1, skip_frame_); | 312 | vpt_process.addTaskTracker(task_id, 1, 1, skip_frame_); |
@@ -510,6 +521,11 @@ void CMultiSourceProcess::CloseAllTask(){ | @@ -510,6 +521,11 @@ void CMultiSourceProcess::CloseAllTask(){ | ||
510 | m_pAlgorthimThread = nullptr; | 521 | m_pAlgorthimThread = nullptr; |
511 | } | 522 | } |
512 | 523 | ||
524 | + if(m_recode_thread){ | ||
525 | + m_recode_thread->join(); | ||
526 | + m_recode_thread = nullptr; | ||
527 | + } | ||
528 | + | ||
513 | if(m_timing_snapshot_thread != nullptr && m_timing_snapshot_thread->joinable()){ | 529 | if(m_timing_snapshot_thread != nullptr && m_timing_snapshot_thread->joinable()){ |
514 | m_timing_snapshot_thread->join(); | 530 | m_timing_snapshot_thread->join(); |
515 | m_timing_snapshot_thread = nullptr; | 531 | m_timing_snapshot_thread = nullptr; |
@@ -1298,4 +1314,31 @@ void CMultiSourceProcess::face_locus_finished(const OBJ_KEY obj_key) { | @@ -1298,4 +1314,31 @@ void CMultiSourceProcess::face_locus_finished(const OBJ_KEY obj_key) { | ||
1298 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(roi_save_info); | 1314 | m_save_snapshot_reprocessing->reprocessing_process_wo_locus_async(roi_save_info); |
1299 | 1315 | ||
1300 | _total_face_snapshot_info.erase(obj_key); | 1316 | _total_face_snapshot_info.erase(obj_key); |
1317 | +} | ||
1318 | + | ||
1319 | +int CMultiSourceProcess::recode_thread() { | ||
1320 | + LOG_INFO("recode_thread start..."); | ||
1321 | + | ||
1322 | + while(true) { | ||
1323 | + | ||
1324 | + if(m_bfinish){ | ||
1325 | + break; | ||
1326 | + } | ||
1327 | + | ||
1328 | + m_recoderinfo_queue_mtx.lock(); | ||
1329 | + if(m_recoderinfo_queue.size() <= 0) { | ||
1330 | + m_recoderinfo_queue_mtx.unlock(); | ||
1331 | + std::this_thread::sleep_for(std::chrono::milliseconds(5)); | ||
1332 | + continue; | ||
1333 | + } | ||
1334 | + | ||
1335 | + RecoderInfo info = m_recoderinfo_queue.front(); | ||
1336 | + m_recoderinfo_queue.pop_front(); | ||
1337 | + m_recoderinfo_queue_mtx.unlock(); | ||
1338 | + | ||
1339 | + DecoderManager* pDecManager = DecoderManager::getInstance(); | ||
1340 | + pDecManager->doRecode(info); | ||
1341 | + } | ||
1342 | + | ||
1343 | + LOG_INFO("recode_thread end."); | ||
1301 | } | 1344 | } |
1302 | \ No newline at end of file | 1345 | \ No newline at end of file |
src/ai_platform/MultiSourceProcess.h
@@ -51,6 +51,8 @@ public: | @@ -51,6 +51,8 @@ public: | ||
51 | void task_finished(const string task_id); | 51 | void task_finished(const string task_id); |
52 | void decoded_cbk(DeviceMemory* devFrame); | 52 | void decoded_cbk(DeviceMemory* devFrame); |
53 | void timing_snapshot_thread(); | 53 | void timing_snapshot_thread(); |
54 | + // 发送录制消息给任务 | ||
55 | + int recode_thread(); | ||
54 | 56 | ||
55 | private: | 57 | private: |
56 | // 算法相关 | 58 | // 算法相关 |
@@ -120,4 +122,8 @@ private: | @@ -120,4 +122,8 @@ private: | ||
120 | 122 | ||
121 | face_det_ai_engine m_face_det_ai_engine; // 人脸检测 | 123 | face_det_ai_engine m_face_det_ai_engine; // 人脸检测 |
122 | 124 | ||
125 | + deque<RecoderInfo> m_recoderinfo_queue; | ||
126 | + mutex m_recoderinfo_queue_mtx; | ||
127 | + thread* m_recode_thread {nullptr}; | ||
128 | + | ||
123 | }; | 129 | }; |
124 | \ No newline at end of file | 130 | \ No newline at end of file |
src/ai_platform/common_header.h
@@ -36,6 +36,7 @@ struct RecoderInfo { | @@ -36,6 +36,7 @@ struct RecoderInfo { | ||
36 | std::string task_id; | 36 | std::string task_id; |
37 | std::string object_id; | 37 | std::string object_id; |
38 | unsigned long long frame_nb; | 38 | unsigned long long frame_nb; |
39 | + std::string mq_info; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | #endif // ___COMMON_HEADER_H__ | 42 | #endif // ___COMMON_HEADER_H__ |
42 | \ No newline at end of file | 43 | \ No newline at end of file |
src/decoder/dvpp/DvppDecoder.cpp
@@ -245,6 +245,8 @@ void DvppDecoder::close(){ | @@ -245,6 +245,8 @@ void DvppDecoder::close(){ | ||
245 | if(m_read_thread != 0){ | 245 | if(m_read_thread != 0){ |
246 | pthread_join(m_read_thread,0); | 246 | pthread_join(m_read_thread,0); |
247 | } | 247 | } |
248 | + | ||
249 | + m_recoderManager.close(); | ||
248 | } | 250 | } |
249 | 251 | ||
250 | void DvppDecoder::setPostDecArg(const void* postDecArg){ | 252 | void DvppDecoder::setPostDecArg(const void* postDecArg){ |
@@ -886,4 +888,8 @@ void DvppDecoder::release_dvpp(){ | @@ -886,4 +888,8 @@ void DvppDecoder::release_dvpp(){ | ||
886 | 888 | ||
887 | void DvppDecoder::doRecode(RecoderInfo& recoderInfo) { | 889 | void DvppDecoder::doRecode(RecoderInfo& recoderInfo) { |
888 | m_recoderManager.create_recode_task2(recoderInfo); | 890 | m_recoderManager.create_recode_task2(recoderInfo); |
891 | +} | ||
892 | + | ||
893 | +void DvppDecoder::set_mq_callback(mq_callback_t cb) { | ||
894 | + m_recoderManager.set_mq_callback(cb); | ||
889 | } | 895 | } |
890 | \ No newline at end of file | 896 | \ No newline at end of file |
src/decoder/dvpp/DvppDecoder.h
@@ -54,6 +54,8 @@ public: | @@ -54,6 +54,8 @@ public: | ||
54 | 54 | ||
55 | void doRecode(RecoderInfo& recoderInfo); | 55 | void doRecode(RecoderInfo& recoderInfo); |
56 | 56 | ||
57 | + void set_mq_callback(mq_callback_t cb); | ||
58 | + | ||
57 | public: | 59 | public: |
58 | void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output, unsigned long long frame_nb); | 60 | void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output, unsigned long long frame_nb); |
59 | void doProcessReport(); | 61 | void doProcessReport(); |
src/decoder/dvpp/DvppDecoderApi.cpp
@@ -136,4 +136,10 @@ void DvppDecoderApi::doRecode(RecoderInfo& recoderInfo) { | @@ -136,4 +136,10 @@ void DvppDecoderApi::doRecode(RecoderInfo& recoderInfo) { | ||
136 | if(m_pDecoder != nullptr){ | 136 | if(m_pDecoder != nullptr){ |
137 | return m_pDecoder->doRecode(recoderInfo); | 137 | return m_pDecoder->doRecode(recoderInfo); |
138 | } | 138 | } |
139 | +} | ||
140 | + | ||
141 | +void DvppDecoderApi::set_mq_callback(std::function<bool(const char *msg)> mq_publish) { | ||
142 | + if(m_pDecoder != nullptr){ | ||
143 | + return m_pDecoder->set_mq_callback(mq_publish); | ||
144 | + } | ||
139 | } | 145 | } |
140 | \ No newline at end of file | 146 | \ No newline at end of file |
src/decoder/dvpp/DvppDecoderApi.h
@@ -41,6 +41,8 @@ public: | @@ -41,6 +41,8 @@ public: | ||
41 | void setFinishedDecArg(const void* finishedDecArg); | 41 | void setFinishedDecArg(const void* finishedDecArg); |
42 | 42 | ||
43 | void doRecode(RecoderInfo& recoderInfo); | 43 | void doRecode(RecoderInfo& recoderInfo); |
44 | + | ||
45 | + void set_mq_callback(std::function<bool(const char *msg)> mq_publish); | ||
44 | private: | 46 | private: |
45 | DvppDecoder* m_pDecoder; | 47 | DvppDecoder* m_pDecoder; |
46 | }; | 48 | }; |
47 | \ No newline at end of file | 49 | \ No newline at end of file |
src/decoder/dvpp/FFRecoder.cpp
@@ -123,7 +123,7 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx, | @@ -123,7 +123,7 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx, | ||
123 | 123 | ||
124 | bool FFRecoder::init(AVRational time_base, AVCodecContext* avctx, const char* outfile_name) { | 124 | bool FFRecoder::init(AVRational time_base, AVCodecContext* avctx, const char* outfile_name) { |
125 | 125 | ||
126 | - codec_ctx_ = new AVCodecContext(); | 126 | + codec_ctx_ = (AVCodecContext*)av_malloc(sizeof(AVCodecContext)); |
127 | avcodec_copy_context(codec_ctx_, avctx); | 127 | avcodec_copy_context(codec_ctx_, avctx); |
128 | codec_ctx_->time_base = time_base; | 128 | codec_ctx_->time_base = time_base; |
129 | 129 | ||
@@ -244,6 +244,11 @@ void FFRecoder::update_pts(AVPacket* pkt) { | @@ -244,6 +244,11 @@ void FFRecoder::update_pts(AVPacket* pkt) { | ||
244 | bool FFRecoder::write_pkt(AVPacket *pkt) { | 244 | bool FFRecoder::write_pkt(AVPacket *pkt) { |
245 | char errbuf[64]{ 0 }; | 245 | char errbuf[64]{ 0 }; |
246 | 246 | ||
247 | + // frame_number++; | ||
248 | + // pkt->pts = av_rescale_q(frame_number, codec_ctx_->time_base, out_stream_->time_base); | ||
249 | + // pkt->dts = pkt->pts; | ||
250 | + // pkt->duration = av_rescale_q(1, codec_ctx_->time_base, out_stream_->time_base); | ||
251 | + | ||
247 | av_packet_rescale_ts(pkt, codec_ctx_->time_base, out_stream_->time_base); | 252 | av_packet_rescale_ts(pkt, codec_ctx_->time_base, out_stream_->time_base); |
248 | pkt->stream_index = out_stream_->index; | 253 | pkt->stream_index = out_stream_->index; |
249 | update_pts(pkt); | 254 | update_pts(pkt); |
src/decoder/dvpp/FFRecoder.h
src/decoder/dvpp/FFRecoderTaskManager.cpp
@@ -56,6 +56,11 @@ bool FFRecoderTaskManager::init(AVRational time_base, AVCodecContext* avctx){ | @@ -56,6 +56,11 @@ bool FFRecoderTaskManager::init(AVRational time_base, AVCodecContext* avctx){ | ||
56 | } | 56 | } |
57 | 57 | ||
58 | void FFRecoderTaskManager::cache_pkt(AVPacket* pkt, long long frame_nb){ | 58 | void FFRecoderTaskManager::cache_pkt(AVPacket* pkt, long long frame_nb){ |
59 | + if(m_bExit) { | ||
60 | + // 任务退出了就不再缓存数据了 | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
59 | std::lock_guard<std::mutex> l_pkt(m_pkt_list_mtx); | 64 | std::lock_guard<std::mutex> l_pkt(m_pkt_list_mtx); |
60 | 65 | ||
61 | // 考虑到一个AVPacket中的数据并不很大,为减少与解码模块的耦合度,方便管理,这里做一个clone | 66 | // 考虑到一个AVPacket中的数据并不很大,为减少与解码模块的耦合度,方便管理,这里做一个clone |
@@ -131,6 +136,14 @@ list<DataPacket*>::iterator FFRecoderTaskManager::getStartIterator(unsigned long | @@ -131,6 +136,14 @@ list<DataPacket*>::iterator FFRecoderTaskManager::getStartIterator(unsigned long | ||
131 | return it_first; | 136 | return it_first; |
132 | } | 137 | } |
133 | 138 | ||
139 | + // auto it_second = m_pkt_list.begin(); | ||
140 | + // for(;it_second != m_pkt_list.end(); it_second++) { | ||
141 | + // DataPacket* dataPkt = *it_second; | ||
142 | + // if (dataPkt->frame_nb >= start_frame_nb){ | ||
143 | + // return it_second; | ||
144 | + // } | ||
145 | + // } | ||
146 | + | ||
134 | auto it_second = m_pkt_list.begin(); | 147 | auto it_second = m_pkt_list.begin(); |
135 | for(;it_second != m_pkt_list.end(); it_second++) { | 148 | for(;it_second != m_pkt_list.end(); it_second++) { |
136 | DataPacket* dataPkt = *it_second; | 149 | DataPacket* dataPkt = *it_second; |
@@ -179,6 +192,10 @@ void FFRecoderTaskManager::create_recode_task(AVRational time_base, AVCodecConte | @@ -179,6 +192,10 @@ void FFRecoderTaskManager::create_recode_task(AVRational time_base, AVCodecConte | ||
179 | } | 192 | } |
180 | 193 | ||
181 | void FFRecoderTaskManager::create_recode_task2(RecoderInfo& recoderInfo) { | 194 | void FFRecoderTaskManager::create_recode_task2(RecoderInfo& recoderInfo) { |
195 | + if(m_bExit) { | ||
196 | + // 任务退出了就不再接收录制任务 | ||
197 | + return; | ||
198 | + } | ||
182 | save_intask_recoderinfo(recoderInfo); | 199 | save_intask_recoderinfo(recoderInfo); |
183 | } | 200 | } |
184 | 201 | ||
@@ -219,8 +236,12 @@ void FFRecoderTaskManager::recode_thread(RecodeParam recodeParam){ | @@ -219,8 +236,12 @@ void FFRecoderTaskManager::recode_thread(RecodeParam recodeParam){ | ||
219 | } | 236 | } |
220 | 237 | ||
221 | void FFRecoderTaskManager::recode_thread2() { | 238 | void FFRecoderTaskManager::recode_thread2() { |
222 | - | 239 | + LOG_INFO("recode_thread2 start..."); |
223 | while(true) { | 240 | while(true) { |
241 | + if(m_bExit) { | ||
242 | + break; | ||
243 | + } | ||
244 | + | ||
224 | m_recoderinfo_list_mtx.lock(); | 245 | m_recoderinfo_list_mtx.lock(); |
225 | if(m_recoderinfo_list.size() <= 0){ | 246 | if(m_recoderinfo_list.size() <= 0){ |
226 | m_recoderinfo_list_mtx.unlock(); | 247 | m_recoderinfo_list_mtx.unlock(); |
@@ -258,6 +279,7 @@ void FFRecoderTaskManager::recode_thread2() { | @@ -258,6 +279,7 @@ void FFRecoderTaskManager::recode_thread2() { | ||
258 | bool bInit = ffrecoder.init(m_time_base, m_avctx, file_name.c_str()); | 279 | bool bInit = ffrecoder.init(m_time_base, m_avctx, file_name.c_str()); |
259 | if (!bInit) { | 280 | if (!bInit) { |
260 | LOG_ERROR("ffrecoder init error : {} {} {}", recoderinfo.task_id, recoderinfo.object_id, recoderinfo.frame_nb); | 281 | LOG_ERROR("ffrecoder init error : {} {} {}", recoderinfo.task_id, recoderinfo.object_id, recoderinfo.frame_nb); |
282 | + ffrecoder.uninit(); | ||
261 | continue; | 283 | continue; |
262 | } | 284 | } |
263 | LOG_INFO("record start, pkt_list size: {} id: {}", m_pkt_list.size(), id); | 285 | LOG_INFO("record start, pkt_list size: {} id: {}", m_pkt_list.size(), id); |
@@ -277,7 +299,34 @@ void FFRecoderTaskManager::recode_thread2() { | @@ -277,7 +299,34 @@ void FFRecoderTaskManager::recode_thread2() { | ||
277 | // ffrecoder.flush(); | 299 | // ffrecoder.flush(); |
278 | ffrecoder.uninit(); | 300 | ffrecoder.uninit(); |
279 | 301 | ||
302 | + // 发送mq消息 | ||
303 | + if(mq_publish_func) { | ||
304 | + mq_publish_func(recoderinfo.mq_info.c_str()); | ||
305 | + } | ||
306 | + | ||
280 | LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name); | 307 | LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name); |
281 | } | 308 | } |
282 | 309 | ||
310 | + LOG_INFO("recode_thread2 end."); | ||
311 | +} | ||
312 | + | ||
313 | +void FFRecoderTaskManager::close() { | ||
314 | + m_bExit = true; | ||
315 | + | ||
316 | + if (m_recoder_thread) { | ||
317 | + m_recoder_thread->join(); | ||
318 | + m_recoder_thread = nullptr; | ||
319 | + } | ||
320 | + | ||
321 | + // 清空数据 | ||
322 | + while(!m_pkt_list.empty()) { | ||
323 | + DataPacket* dataPkt = m_pkt_list.front(); | ||
324 | + delete dataPkt; | ||
325 | + dataPkt = nullptr; | ||
326 | + m_pkt_list.pop_front(); | ||
327 | + } | ||
328 | +} | ||
329 | + | ||
330 | +void FFRecoderTaskManager::set_mq_callback(mq_callback_t cb) { | ||
331 | + mq_publish_func = cb; | ||
283 | } | 332 | } |
284 | \ No newline at end of file | 333 | \ No newline at end of file |
src/decoder/dvpp/FFRecoderTaskManager.h
@@ -18,6 +18,8 @@ struct RecodeParam { | @@ -18,6 +18,8 @@ struct RecodeParam { | ||
18 | AVCodecContext* avctx; | 18 | AVCodecContext* avctx; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | +typedef std::function<bool(const char *msg)> mq_callback_t; | ||
22 | + | ||
21 | class FFRecoderTaskManager { | 23 | class FFRecoderTaskManager { |
22 | public: | 24 | public: |
23 | FFRecoderTaskManager(); | 25 | FFRecoderTaskManager(); |
@@ -29,6 +31,10 @@ public: | @@ -29,6 +31,10 @@ public: | ||
29 | bool init(AVRational time_base, AVCodecContext* avctx); | 31 | bool init(AVRational time_base, AVCodecContext* avctx); |
30 | void create_recode_task2(RecoderInfo& recoderInfo); | 32 | void create_recode_task2(RecoderInfo& recoderInfo); |
31 | 33 | ||
34 | + void close(); | ||
35 | + | ||
36 | + void set_mq_callback(mq_callback_t cb); | ||
37 | + | ||
32 | public: | 38 | public: |
33 | void recode_thread(RecodeParam param); | 39 | void recode_thread(RecodeParam param); |
34 | list<DataPacket*>::iterator getStartIterator(unsigned long long frame_nb); | 40 | list<DataPacket*>::iterator getStartIterator(unsigned long long frame_nb); |
@@ -59,5 +65,7 @@ private: | @@ -59,5 +65,7 @@ private: | ||
59 | AVRational m_time_base; | 65 | AVRational m_time_base; |
60 | AVCodecContext* m_avctx; | 66 | AVCodecContext* m_avctx; |
61 | 67 | ||
62 | - thread* m_recoder_thread {nullptr}; | 68 | + thread* m_recoder_thread{nullptr}; |
69 | + | ||
70 | + mq_callback_t mq_publish_func; | ||
63 | }; | 71 | }; |
64 | \ No newline at end of file | 72 | \ No newline at end of file |
src/decoder/interface/AbstractDecoder.h
@@ -5,6 +5,8 @@ | @@ -5,6 +5,8 @@ | ||
5 | 5 | ||
6 | #include "../../ai_platform/common_header.h" | 6 | #include "../../ai_platform/common_header.h" |
7 | 7 | ||
8 | +#include <functional> | ||
9 | + | ||
8 | using namespace std; | 10 | using namespace std; |
9 | 11 | ||
10 | class AbstractDecoder{ | 12 | class AbstractDecoder{ |
@@ -42,6 +44,8 @@ public: | @@ -42,6 +44,8 @@ public: | ||
42 | 44 | ||
43 | virtual void doRecode(RecoderInfo& recoderInfo) = 0; | 45 | virtual void doRecode(RecoderInfo& recoderInfo) = 0; |
44 | 46 | ||
47 | + virtual void set_mq_callback(std::function<bool(const char *msg)> mq_publish) = 0; | ||
48 | + | ||
45 | public: | 49 | public: |
46 | bool isSnapTime(); | 50 | bool isSnapTime(); |
47 | 51 |
src/decoder/interface/DecoderManager.cpp
@@ -536,4 +536,22 @@ void DecoderManager::doRecode(RecoderInfo& recoderInfo) { | @@ -536,4 +536,22 @@ void DecoderManager::doRecode(RecoderInfo& recoderInfo) { | ||
536 | 536 | ||
537 | LOG_ERROR("没有找到name为{}的解码器",name); | 537 | LOG_ERROR("没有找到name为{}的解码器",name); |
538 | return; | 538 | return; |
539 | +} | ||
540 | + | ||
541 | +void DecoderManager::set_mq_callback(const string name, std::function<bool(const char *msg)> mq_publish) { | ||
542 | + if (name.empty()){ | ||
543 | + LOG_ERROR("name 为空!"); | ||
544 | + return; | ||
545 | + } | ||
546 | + | ||
547 | + std::lock_guard<std::mutex> l(m_mutex); | ||
548 | + | ||
549 | + auto dec = decoderMap.find(name); | ||
550 | + if (dec != decoderMap.end()){ | ||
551 | + dec->second->set_mq_callback(mq_publish); | ||
552 | + return; | ||
553 | + } | ||
554 | + | ||
555 | + LOG_ERROR("没有找到name为{}的解码器",name); | ||
556 | + return; | ||
539 | } | 557 | } |
540 | \ No newline at end of file | 558 | \ No newline at end of file |
src/decoder/interface/DecoderManager.h
@@ -275,6 +275,8 @@ public: | @@ -275,6 +275,8 @@ public: | ||
275 | 275 | ||
276 | void doRecode(RecoderInfo& recoderInfo); | 276 | void doRecode(RecoderInfo& recoderInfo); |
277 | 277 | ||
278 | + void set_mq_callback(const string name, std::function<bool(const char *msg)> mq_publish); | ||
279 | + | ||
278 | private: | 280 | private: |
279 | DecoderManager(){} | 281 | DecoderManager(){} |
280 | 282 |
src/decoder/test_recoder.cpp
@@ -15,13 +15,18 @@ deque<DeviceMemory*> m_RgbDataList; | @@ -15,13 +15,18 @@ deque<DeviceMemory*> m_RgbDataList; | ||
15 | mutex m_DataListMtx; | 15 | mutex m_DataListMtx; |
16 | 16 | ||
17 | thread* m_pAlgorthimThread{nullptr}; | 17 | thread* m_pAlgorthimThread{nullptr}; |
18 | +thread* m_recodeThread{nullptr}; | ||
18 | bool m_bfinish{false}; | 19 | bool m_bfinish{false}; |
19 | int m_devId = 0; | 20 | int m_devId = 0; |
20 | const char* task_id = "test0"; | 21 | const char* task_id = "test0"; |
21 | int skip_frame_ = 5; | 22 | int skip_frame_ = 5; |
22 | int m_batch_size = 20; | 23 | int m_batch_size = 20; |
23 | 24 | ||
25 | +deque<RecoderInfo> m_recoderinfo_queue; | ||
26 | +mutex m_recoderinfo_queue_mtx; | ||
27 | + | ||
24 | void algorthim_process_thread(); | 28 | void algorthim_process_thread(); |
29 | +void recode_thread(); | ||
25 | void algorthim_face_detect(vector<DeviceMemory*> vec_gpuMem); | 30 | void algorthim_face_detect(vector<DeviceMemory*> vec_gpuMem); |
26 | 31 | ||
27 | void post_decod_cbk(const void * userPtr, DeviceMemory* devFrame){ | 32 | void post_decod_cbk(const void * userPtr, DeviceMemory* devFrame){ |
@@ -90,6 +95,12 @@ int main(){ | @@ -90,6 +95,12 @@ int main(){ | ||
90 | } | 95 | } |
91 | , nullptr); | 96 | , nullptr); |
92 | 97 | ||
98 | + m_recodeThread = new thread([](void* arg) { | ||
99 | + recode_thread(); | ||
100 | + return (void*)0; | ||
101 | + } | ||
102 | + , nullptr); | ||
103 | + | ||
93 | pDecManager->startDecodeByName(config.name); | 104 | pDecManager->startDecodeByName(config.name); |
94 | 105 | ||
95 | while (getchar() != 'q'); | 106 | while (getchar() != 'q'); |
@@ -162,10 +173,31 @@ void algorthim_face_detect(vector<DeviceMemory*> vec_gpuMem) { | @@ -162,10 +173,31 @@ void algorthim_face_detect(vector<DeviceMemory*> vec_gpuMem) { | ||
162 | recoderInfo.object_id = std::to_string(obj_id); | 173 | recoderInfo.object_id = std::to_string(obj_id); |
163 | recoderInfo.recoderDir = "./res/recode"; | 174 | recoderInfo.recoderDir = "./res/recode"; |
164 | recoderInfo.frame_nb = mem->getFrameNb(); | 175 | recoderInfo.frame_nb = mem->getFrameNb(); |
165 | - DecoderManager* pDecManager = DecoderManager::getInstance(); | ||
166 | - pDecManager->doRecode(recoderInfo); | 176 | + |
177 | + m_recoderinfo_queue_mtx.lock(); | ||
178 | + m_recoderinfo_queue.push_back(recoderInfo); | ||
179 | + m_recoderinfo_queue_mtx.unlock(); | ||
167 | 180 | ||
168 | obj_id++; | 181 | obj_id++; |
169 | 182 | ||
170 | } | 183 | } |
184 | +} | ||
185 | + | ||
186 | +void recode_thread() { | ||
187 | + while(true) { | ||
188 | + | ||
189 | + m_recoderinfo_queue_mtx.lock(); | ||
190 | + if(m_recoderinfo_queue.size() <= 0) { | ||
191 | + m_recoderinfo_queue_mtx.unlock(); | ||
192 | + std::this_thread::sleep_for(std::chrono::milliseconds(5)); | ||
193 | + continue; | ||
194 | + } | ||
195 | + | ||
196 | + RecoderInfo info = m_recoderinfo_queue.front(); | ||
197 | + m_recoderinfo_queue.pop_front(); | ||
198 | + m_recoderinfo_queue_mtx.unlock(); | ||
199 | + | ||
200 | + DecoderManager* pDecManager = DecoderManager::getInstance(); | ||
201 | + pDecManager->doRecode(info); | ||
202 | + } | ||
171 | } | 203 | } |
172 | \ No newline at end of file | 204 | \ No newline at end of file |