Commit c4e50858604d927a3467ae4d0c3b3c63b4a35afb

Authored by Hu Chunming
2 parents aeb77c80 af3f87b8

Merge branch 'dev-cmhu' into 'master'

Dev cmhu

See merge request !5
.gitignore
1 bin/test_recoder 1 bin/test_recoder
2 .vscode/launch.json 2 .vscode/launch.json
3 bin/logs/* 3 bin/logs/*
4 -bin/res/*  
5 \ No newline at end of file 4 \ No newline at end of file
  5 +bin/res/*
  6 +bin/vpt_proj
  7 +bin/libvpt_ascend.so
bin/libvpt_ascend.so deleted
No preview for this file type
bin/vpt_proj deleted
No preview for this file type
src/ai_engine_module/motocycle_hs_process.cpp
@@ -81,11 +81,11 @@ namespace ai_engine_module @@ -81,11 +81,11 @@ namespace ai_engine_module
81 } 81 }
82 } 82 }
83 83
84 - bool MotorHsProcess::init(int gpu_id) 84 + bool MotorHsProcess::init(int gpu_id, string models_dir)
85 { 85 {
86 init_ = false; 86 init_ = false;
87 87
88 - string model_path = "./models/hs/hs_motor_310p.om" ; 88 + string model_path = models_dir + "/models/hs/hs_motor_310p.om" ;
89 LOG_INFO("hs_motor 版本:{} 模型路径:{}", hs_motor_getversion(), model_path); 89 LOG_INFO("hs_motor 版本:{} 模型路径:{}", hs_motor_getversion(), model_path);
90 90
91 hs_motor_param param; 91 hs_motor_param param;
src/ai_engine_module/motocycle_hs_process.h
@@ -84,7 +84,7 @@ namespace ai_engine_module @@ -84,7 +84,7 @@ namespace ai_engine_module
84 ~MotorHsProcess(); 84 ~MotorHsProcess();
85 85
86 bool check_initied(); 86 bool check_initied();
87 - bool init(int gpu_id); 87 + bool init(int gpu_id, string models_dir);
88 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results); 88 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
89 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true); 89 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
90 90
src/ai_engine_module/tricycle_manned_process.cpp
@@ -29,11 +29,11 @@ namespace ai_engine_module @@ -29,11 +29,11 @@ namespace ai_engine_module
29 } 29 }
30 } 30 }
31 31
32 - bool TricycleMannedProcess::init(int gpu_id) 32 + bool TricycleMannedProcess::init(int gpu_id, string models_dir)
33 { 33 {
34 init_ = false; 34 init_ = false;
35 35
36 - string model_path = "./models/hs/hs_tricycle_310p.om" ; 36 + string model_path = models_dir + "/models/hs/hs_tricycle_310p.om" ;
37 LOG_INFO("hs_tri 版本:{} 模型路径:{}", hs_tri_getversion(), model_path); 37 LOG_INFO("hs_tri 版本:{} 模型路径:{}", hs_tri_getversion(), model_path);
38 38
39 hs_tri_param param; 39 hs_tri_param param;
src/ai_engine_module/tricycle_manned_process.h
@@ -75,7 +75,7 @@ namespace ai_engine_module @@ -75,7 +75,7 @@ namespace ai_engine_module
75 ~TricycleMannedProcess(); 75 ~TricycleMannedProcess();
76 76
77 bool check_initied(); 77 bool check_initied();
78 - bool init(int gpu_id); 78 + bool init(int gpu_id, string models_dir);
79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results); 79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true); 80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
81 81
src/ai_engine_module/truck_manned_process.cpp
@@ -29,11 +29,11 @@ namespace ai_engine_module @@ -29,11 +29,11 @@ namespace ai_engine_module
29 } 29 }
30 } 30 }
31 31
32 - bool TruckMannedProcess::init(int gpu_id) 32 + bool TruckMannedProcess::init(int gpu_id, string models_dir)
33 { 33 {
34 init_ = false; 34 init_ = false;
35 35
36 - string model_path = "./models/hs/hs_truck_310p.om" ; 36 + string model_path = models_dir + "/models/hs/hs_truck_310p.om" ;
37 LOG_INFO("hs_truck 版本:{} 模型路径:{}", hs_truck_getversion(), model_path); 37 LOG_INFO("hs_truck 版本:{} 模型路径:{}", hs_truck_getversion(), model_path);
38 38
39 hs_truck_param param; 39 hs_truck_param param;
src/ai_engine_module/truck_manned_process.h
@@ -75,7 +75,7 @@ namespace ai_engine_module @@ -75,7 +75,7 @@ namespace ai_engine_module
75 ~TruckMannedProcess(); 75 ~TruckMannedProcess();
76 76
77 bool check_initied(); 77 bool check_initied();
78 - bool init(int gpu_id); 78 + bool init(int gpu_id, string models_dir);
79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results); 79 bool update_mstreams(const std::vector<task_id_t>& taskIds, vector<DeviceMemory*> vec_det_input_images, const std::vector<onelevel_det_result> &det_results);
80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true); 80 std::shared_ptr<results_data_t> get_result_by_objectid(const id_t& id, bool do_erase = true);
81 81
src/ai_platform/MultiSourceProcess.cpp
@@ -109,19 +109,19 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){ @@ -109,19 +109,19 @@ int CMultiSourceProcess::InitAlgorthim(tsl_aiplatform_param vptParam){
109 } 109 }
110 110
111 //三轮车头肩检测 111 //三轮车头肩检测
112 - if (!tricycle_manned_.init(vptParam.gpuid)) { 112 + if (!tricycle_manned_.init(vptParam.gpuid, models_dir)) {
113 LOG_FATAL("Init tricycle_hs failed"); 113 LOG_FATAL("Init tricycle_hs failed");
114 return -1; 114 return -1;
115 } 115 }
116 116
117 //货车头肩检测 117 //货车头肩检测
118 - if (!truck_manned_.init(vptParam.gpuid)) { 118 + if (!truck_manned_.init(vptParam.gpuid, models_dir)) {
119 LOG_FATAL("Init truck_hs failed"); 119 LOG_FATAL("Init truck_hs failed");
120 return -1; 120 return -1;
121 } 121 }
122 122
123 //二轮车头肩检测 123 //二轮车头肩检测
124 - if (!motor_hsprocess_.init(vptParam.gpuid)) { 124 + if (!motor_hsprocess_.init(vptParam.gpuid, models_dir)) {
125 LOG_FATAL("Init motor_hs failed"); 125 LOG_FATAL("Init motor_hs failed");
126 return -1; 126 return -1;
127 } 127 }
@@ -1303,7 +1303,7 @@ void CMultiSourceProcess::manned_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id, @@ -1303,7 +1303,7 @@ void CMultiSourceProcess::manned_snapshot(vector&lt;string&gt;&amp; vpt_interest_task_id,
1303 RecoderInfo recoderInfo; 1303 RecoderInfo recoderInfo;
1304 recoderInfo.task_id = task_id; 1304 recoderInfo.task_id = task_id;
1305 recoderInfo.object_id = std::to_string(j); 1305 recoderInfo.object_id = std::to_string(j);
1306 - recoderInfo.recoderDir = "./res/recode"; 1306 + recoderInfo.recoderPath = "./res/recode";
1307 recoderInfo.frame_nb = mem->getFrameNb(); 1307 recoderInfo.frame_nb = mem->getFrameNb();
1308 1308
1309 m_recoderinfo_queue_mtx.lock(); 1309 m_recoderinfo_queue_mtx.lock();
src/ai_platform/common_header.h
@@ -32,7 +32,7 @@ struct box_t { @@ -32,7 +32,7 @@ struct box_t {
32 }; 32 };
33 33
34 struct RecoderInfo { 34 struct RecoderInfo {
35 - std::string recoderDir; 35 + std::string recoderPath;
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;
src/decoder/dvpp/FFRecoder.cpp
@@ -39,13 +39,13 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx, @@ -39,13 +39,13 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx,
39 // [1] 创建解码器 39 // [1] 创建解码器
40 const AVCodec* encoder = avcodec_find_encoder(AV_CODEC_ID_HEVC); 40 const AVCodec* encoder = avcodec_find_encoder(AV_CODEC_ID_HEVC);
41 if (!encoder) { 41 if (!encoder) {
42 - fprintf(stderr, "Find encoder AV_CODEC_ID_H264 failed!\n"); 42 + LOG_ERROR("Find encoder AV_CODEC_ID_H264 failed!");
43 return false; 43 return false;
44 } 44 }
45 // 获取解码器上下文 45 // 获取解码器上下文
46 codec_ctx_ = avcodec_alloc_context3(encoder); 46 codec_ctx_ = avcodec_alloc_context3(encoder);
47 if (!codec_ctx_) { 47 if (!codec_ctx_) {
48 - fprintf(stderr, "Alloc context for encoder contx failed!\n"); 48 + LOG_ERROR("Alloc context for encoder contx failed!");
49 return false; 49 return false;
50 } 50 }
51 // 设置解码器上下文参数 51 // 设置解码器上下文参数
@@ -68,7 +68,7 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx, @@ -68,7 +68,7 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx,
68 // 打开解码器 68 // 打开解码器
69 int ret = avcodec_open2(codec_ctx_, encoder, nullptr); 69 int ret = avcodec_open2(codec_ctx_, encoder, nullptr);
70 if (ret < 0) { 70 if (ret < 0) {
71 - fprintf(stderr, "Open encoder failed!\n"); 71 + LOG_ERROR("Open encoder failed!");
72 return false; 72 return false;
73 } 73 }
74 74
@@ -93,17 +93,17 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx, @@ -93,17 +93,17 @@ bool FFRecoder::init(int w, int h, AVRational time_base, AVCodecContext* avctx,
93 if (av_frame_get_buffer(yuv_frame_, 0) < 0) { 93 if (av_frame_get_buffer(yuv_frame_, 0) < 0) {
94 av_frame_free(&yuv_frame_); 94 av_frame_free(&yuv_frame_);
95 yuv_frame_ = nullptr; 95 yuv_frame_ = nullptr;
96 - fprintf(stderr, "Frame get buffer failed!\n"); 96 + LOG_ERROR("Frame get buffer failed!");
97 return false; 97 return false;
98 } 98 }
99 99
100 // [5] 打开输出视频文件并写入视频头信息 100 // [5] 打开输出视频文件并写入视频头信息
101 if (avio_open(&fmt_ctx_->pb, outfile_name, AVIO_FLAG_WRITE) < 0) { 101 if (avio_open(&fmt_ctx_->pb, outfile_name, AVIO_FLAG_WRITE) < 0) {
102 - fprintf(stderr, "avio_open failed!\n"); 102 + LOG_ERROR("avio_open failed!");
103 return false; 103 return false;
104 } 104 }
105 if (avformat_write_header(fmt_ctx_, nullptr) < 0) { 105 if (avformat_write_header(fmt_ctx_, nullptr) < 0) {
106 - fprintf(stderr, "Write header failed!\n"); 106 + LOG_ERROR("Write header failed!");
107 return false; 107 return false;
108 } 108 }
109 109
@@ -150,11 +150,11 @@ bool FFRecoder::init(AVStream* stream, AVCodecContext* avctx, const char* outfil @@ -150,11 +150,11 @@ bool FFRecoder::init(AVStream* stream, AVCodecContext* avctx, const char* outfil
150 150
151 // [5] 打开输出视频文件并写入视频头信息 151 // [5] 打开输出视频文件并写入视频头信息
152 if (avio_open(&fmt_ctx_->pb, outfile_name, AVIO_FLAG_WRITE) < 0) { 152 if (avio_open(&fmt_ctx_->pb, outfile_name, AVIO_FLAG_WRITE) < 0) {
153 - fprintf(stderr, "avio_open failed!\n"); 153 + LOG_ERROR("avio_open failed!");
154 return false; 154 return false;
155 } 155 }
156 if (avformat_write_header(fmt_ctx_, nullptr) < 0) { 156 if (avformat_write_header(fmt_ctx_, nullptr) < 0) {
157 - fprintf(stderr, "Write header failed!\n"); 157 + LOG_ERROR("Write header failed!");
158 return false; 158 return false;
159 } 159 }
160 160
@@ -270,7 +270,7 @@ bool FFRecoder::write_pkt(AVPacket *pkt) { @@ -270,7 +270,7 @@ bool FFRecoder::write_pkt(AVPacket *pkt) {
270 // pkt->stream_index = out_stream_->index; 270 // pkt->stream_index = out_stream_->index;
271 271
272 if(pkt->pts==AV_NOPTS_VALUE) { 272 if(pkt->pts==AV_NOPTS_VALUE) {
273 - // printf("frame_index:%d\n", frame_index); 273 + // printf("frame_index:%d", frame_index);
274 //Write PTS 274 //Write PTS
275 AVRational time_base1 = codec_ctx_->time_base; 275 AVRational time_base1 = codec_ctx_->time_base;
276 //Duration between 2 frames (us) 276 //Duration between 2 frames (us)
@@ -293,7 +293,7 @@ bool FFRecoder::write_pkt(AVPacket *pkt) { @@ -293,7 +293,7 @@ bool FFRecoder::write_pkt(AVPacket *pkt) {
293 // 将数据写入到输出流 293 // 将数据写入到输出流
294 int ret = av_write_frame(fmt_ctx_, pkt); 294 int ret = av_write_frame(fmt_ctx_, pkt);
295 if (ret < 0) { 295 if (ret < 0) {
296 - fprintf(stderr, "Error while writing output packet: %s\n", av_make_error_string(errbuf, sizeof(errbuf), ret)); 296 + LOG_ERROR("Error while writing output packet: {}", av_make_error_string(errbuf, sizeof(errbuf), ret));
297 return false; 297 return false;
298 } 298 }
299 return true; 299 return true;
@@ -316,7 +316,7 @@ bool FFRecoder::write_frame(AVFrame* frame) @@ -316,7 +316,7 @@ bool FFRecoder::write_frame(AVFrame* frame)
316 int ret = avcodec_send_frame(codec_ctx_, pFrameOut); 316 int ret = avcodec_send_frame(codec_ctx_, pFrameOut);
317 av_frame_free(&pFrameOut); 317 av_frame_free(&pFrameOut);
318 if (ret < 0) { 318 if (ret < 0) {
319 - fprintf(stderr, "Error sending a frame to the encoder: %s\n", av_make_error_string(errbuf, sizeof(errbuf), ret)); 319 + LOG_ERROR("Error sending a frame to the encoder: {}", av_make_error_string(errbuf, sizeof(errbuf), ret));
320 return false; 320 return false;
321 } 321 }
322 322
@@ -327,7 +327,7 @@ bool FFRecoder::write_frame(AVFrame* frame) @@ -327,7 +327,7 @@ bool FFRecoder::write_frame(AVFrame* frame)
327 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) 327 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
328 return true; 328 return true;
329 else if (ret < 0) { 329 else if (ret < 0) {
330 - fprintf(stderr, "Error encoding a frame: %s\n", av_make_error_string(errbuf, sizeof(errbuf), ret)); 330 + LOG_ERROR("Error encoding a frame: {}", av_make_error_string(errbuf, sizeof(errbuf), ret));
331 return false; 331 return false;
332 } 332 }
333 // 将pts缩放到输出流的time_base上 333 // 将pts缩放到输出流的time_base上
@@ -339,7 +339,7 @@ bool FFRecoder::write_frame(AVFrame* frame) @@ -339,7 +339,7 @@ bool FFRecoder::write_frame(AVFrame* frame)
339 //ret = av_write_frame(fmt_ctx_, &pkt); 339 //ret = av_write_frame(fmt_ctx_, &pkt);
340 av_packet_unref(&pkt); 340 av_packet_unref(&pkt);
341 if (ret < 0) { 341 if (ret < 0) {
342 - fprintf(stderr, "Error while writing output packet: %s\n", av_make_error_string(errbuf, sizeof(errbuf), ret)); 342 + LOG_ERROR("Error while writing output packet: {}", av_make_error_string(errbuf, sizeof(errbuf), ret));
343 return false; 343 return false;
344 } 344 }
345 /* av_interleaved_write_frame(fmt_ctx_, nullptr); 345 /* av_interleaved_write_frame(fmt_ctx_, nullptr);
src/decoder/dvpp/FFRecoder.h
1 #pragma once 1 #pragma once
2 #include <memory> 2 #include <memory>
3 3
4 -extern "C" {  
5 - #include <libavcodec/avcodec.h>  
6 - #include <libavformat/avformat.h>  
7 - #include <libavutil/opt.h>  
8 - #include <libavutil/timestamp.h>  
9 - #include <libavutil/imgutils.h>  
10 - #include <libswscale/swscale.h>  
11 -} 4 +#include "depend_headers.h"
12 5
13 class FFRecoder 6 class FFRecoder
14 { 7 {
src/decoder/dvpp/FFRecoderTaskManager.cpp
@@ -198,14 +198,6 @@ list&lt;DataPacket*&gt;::iterator FFRecoderTaskManager::getStartIterator(unsigned long @@ -198,14 +198,6 @@ list&lt;DataPacket*&gt;::iterator FFRecoderTaskManager::getStartIterator(unsigned long
198 return it_first; 198 return it_first;
199 } 199 }
200 200
201 - // auto it_second = m_pkt_list.begin();  
202 - // for(;it_second != m_pkt_list.end(); it_second++) {  
203 - // DataPacket* dataPkt = *it_second;  
204 - // if (dataPkt->frame_nb >= start_frame_nb){  
205 - // return it_second;  
206 - // }  
207 - // }  
208 -  
209 auto it_second = m_pkt_list.begin(); 201 auto it_second = m_pkt_list.begin();
210 for(;it_second != m_pkt_list.end(); it_second++) { 202 for(;it_second != m_pkt_list.end(); it_second++) {
211 DataPacket* dataPkt = *it_second; 203 DataPacket* dataPkt = *it_second;
@@ -308,7 +300,7 @@ void FFRecoderTaskManager::recode_thread(RecodeParam recodeParam){ @@ -308,7 +300,7 @@ void FFRecoderTaskManager::recode_thread(RecodeParam recodeParam){
308 RecoderInfo recoderInfo; 300 RecoderInfo recoderInfo;
309 recoderInfo = recodeParam.recoderInfo; 301 recoderInfo = recodeParam.recoderInfo;
310 std::string id = recoderInfo.task_id + "_" + recoderInfo.object_id + "_" + std::to_string(recoderInfo.frame_nb); 302 std::string id = recoderInfo.task_id + "_" + recoderInfo.object_id + "_" + std::to_string(recoderInfo.frame_nb);
311 - string file_name = recoderInfo.recoderDir + "/recoder_" + id + "_" + std::to_string(get_cur_time()) + ".mp4"; 303 + string file_name = recoderInfo.recoderPath;
312 FFRecoder ffrecoder; 304 FFRecoder ffrecoder;
313 bool bInit = ffrecoder.init(m_inStream, recodeParam.avctx, file_name.c_str()); 305 bool bInit = ffrecoder.init(m_inStream, recodeParam.avctx, file_name.c_str());
314 if (!bInit) { 306 if (!bInit) {
@@ -359,8 +351,6 @@ void FFRecoderTaskManager::recode_thread2() { @@ -359,8 +351,6 @@ void FFRecoderTaskManager::recode_thread2() {
359 continue; 351 continue;
360 } 352 }
361 353
362 - auto it_end = getEndIterator(recoderinfo.frame_nb);  
363 -  
364 LOG_INFO("start frame_nb: {}", (*it_data)->frame_nb); 354 LOG_INFO("start frame_nb: {}", (*it_data)->frame_nb);
365 355
366 m_pkt_list_mtx.lock(); 356 m_pkt_list_mtx.lock();
@@ -379,7 +369,7 @@ void FFRecoderTaskManager::recode_thread2() { @@ -379,7 +369,7 @@ void FFRecoderTaskManager::recode_thread2() {
379 m_pkt_list_mtx.unlock(); 369 m_pkt_list_mtx.unlock();
380 370
381 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb); 371 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb);
382 - string file_name = recoderinfo.recoderDir + "/recoder_" + id + "_" + std::to_string(get_cur_time()) + ".mp4"; 372 + string file_name = recoderinfo.recoderPath;
383 FFRecoder ffrecoder; 373 FFRecoder ffrecoder;
384 bool bInit = ffrecoder.init(m_inStream, m_avctx, file_name.c_str()); 374 bool bInit = ffrecoder.init(m_inStream, m_avctx, file_name.c_str());
385 if (!bInit) { 375 if (!bInit) {
@@ -387,7 +377,7 @@ void FFRecoderTaskManager::recode_thread2() { @@ -387,7 +377,7 @@ void FFRecoderTaskManager::recode_thread2() {
387 ffrecoder.uninit(); 377 ffrecoder.uninit();
388 continue; 378 continue;
389 } 379 }
390 - LOG_INFO("record start, pkt_list size: {} id: {}", m_pkt_list.size(), id); 380 + LOG_DEBUG("record start, pkt_list size: {} task_id: {} object_id:{} frame_nb: {}", m_pkt_list.size(), recoderinfo.task_id, recoderinfo.object_id, recoderinfo.frame_nb);
391 381
392 int count = 0; 382 int count = 0;
393 auto it_save = it_data; 383 auto it_save = it_data;
@@ -420,7 +410,7 @@ void FFRecoderTaskManager::recode_thread2() { @@ -420,7 +410,7 @@ void FFRecoderTaskManager::recode_thread2() {
420 } 410 }
421 411
422 void FFRecoderTaskManager::recode_thread3() { 412 void FFRecoderTaskManager::recode_thread3() {
423 - LOG_INFO("recode_thread2 start..."); 413 + LOG_INFO("recode_thread3 start...");
424 while(true) { 414 while(true) {
425 if(m_bExit) { 415 if(m_bExit) {
426 break; 416 break;
@@ -458,7 +448,7 @@ void FFRecoderTaskManager::recode_thread3() { @@ -458,7 +448,7 @@ void FFRecoderTaskManager::recode_thread3() {
458 m_frame_list_mtx.unlock(); 448 m_frame_list_mtx.unlock();
459 449
460 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb); 450 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb);
461 - string file_name = recoderinfo.recoderDir + "/recoder_" + id + "_" + std::to_string(get_cur_time()) + ".mp4"; 451 + string file_name = recoderinfo.recoderPath;
462 FFRecoder ffrecoder; 452 FFRecoder ffrecoder;
463 bool bInit = ffrecoder.init(m_avctx->width, m_avctx->height, m_time_base, m_avctx, file_name.c_str()); 453 bool bInit = ffrecoder.init(m_avctx->width, m_avctx->height, m_time_base, m_avctx, file_name.c_str());
464 if (!bInit) { 454 if (!bInit) {
@@ -491,11 +481,11 @@ void FFRecoderTaskManager::recode_thread3() { @@ -491,11 +481,11 @@ void FFRecoderTaskManager::recode_thread3() {
491 LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name); 481 LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name);
492 } 482 }
493 483
494 - LOG_INFO("recode_thread2 end."); 484 + LOG_INFO("recode_thread3 end.");
495 } 485 }
496 486
497 void FFRecoderTaskManager::recode_thread4() { 487 void FFRecoderTaskManager::recode_thread4() {
498 - LOG_INFO("recode_thread2 start..."); 488 + LOG_INFO("recode_thread4 start...");
499 while(true) { 489 while(true) {
500 if(m_bExit) { 490 if(m_bExit) {
501 break; 491 break;
@@ -533,7 +523,7 @@ void FFRecoderTaskManager::recode_thread4() { @@ -533,7 +523,7 @@ void FFRecoderTaskManager::recode_thread4() {
533 m_pkt_list_mtx.unlock(); 523 m_pkt_list_mtx.unlock();
534 524
535 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb); 525 std::string id = recoderinfo.task_id + "_" + recoderinfo.object_id + "_" + std::to_string(recoderinfo.frame_nb);
536 - string file_name = recoderinfo.recoderDir + "/recoder_" + id + "_" + std::to_string(get_cur_time()) + ".mp4"; 526 + string file_name = recoderinfo.recoderPath;
537 FFRecoder ffrecoder; 527 FFRecoder ffrecoder;
538 bool bInit = ffrecoder.init(m_inStream, m_avctx, file_name.c_str()); 528 bool bInit = ffrecoder.init(m_inStream, m_avctx, file_name.c_str());
539 if (!bInit) { 529 if (!bInit) {
@@ -566,7 +556,7 @@ void FFRecoderTaskManager::recode_thread4() { @@ -566,7 +556,7 @@ void FFRecoderTaskManager::recode_thread4() {
566 LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name); 556 LOG_INFO("record end, total save: {} start_frame_nb: {} end_frame_nb: {} file_path: {}", count, start_frame_nb, end_frame_nb, file_name);
567 } 557 }
568 558
569 - LOG_INFO("recode_thread2 end."); 559 + LOG_INFO("recode_thread4 end.");
570 } 560 }
571 561
572 void FFRecoderTaskManager::close() { 562 void FFRecoderTaskManager::close() {
src/decoder/dvpp/depend_headers.h
@@ -27,6 +27,9 @@ extern &quot;C&quot; { @@ -27,6 +27,9 @@ extern &quot;C&quot; {
27 #include "libavutil/samplefmt.h" 27 #include "libavutil/samplefmt.h"
28 #include "libavformat/avformat.h" 28 #include "libavformat/avformat.h"
29 #include "libavcodec/avcodec.h" 29 #include "libavcodec/avcodec.h"
  30 + #include <libavutil/opt.h>
  31 + #include <libavutil/timestamp.h>
  32 + #include <libswscale/swscale.h>
30 } 33 }
31 34
32 35
src/decoder/test_recoder.cpp
@@ -179,7 +179,7 @@ void algorthim_face_detect(vector&lt;DeviceMemory*&gt; vec_gpuMem) { @@ -179,7 +179,7 @@ void algorthim_face_detect(vector&lt;DeviceMemory*&gt; vec_gpuMem) {
179 RecoderInfo recoderInfo; 179 RecoderInfo recoderInfo;
180 recoderInfo.task_id = task_id; 180 recoderInfo.task_id = task_id;
181 recoderInfo.object_id = std::to_string(obj_id); 181 recoderInfo.object_id = std::to_string(obj_id);
182 - recoderInfo.recoderDir = "./res/recode"; 182 + recoderInfo.recoderPath = "./res/recode";
183 recoderInfo.frame_nb = mem->getFrameNb(); 183 recoderInfo.frame_nb = mem->getFrameNb();
184 184
185 m_recoderinfo_queue_mtx.lock(); 185 m_recoderinfo_queue_mtx.lock();
@@ -211,7 +211,7 @@ void test_recode_thread() { @@ -211,7 +211,7 @@ void test_recode_thread() {
211 RecoderInfo recoderInfo; 211 RecoderInfo recoderInfo;
212 recoderInfo.task_id = gpuMem->getId(); 212 recoderInfo.task_id = gpuMem->getId();
213 recoderInfo.object_id = std::to_string(obj_id); 213 recoderInfo.object_id = std::to_string(obj_id);
214 - recoderInfo.recoderDir = "./res/recode"; 214 + recoderInfo.recoderPath = "./res/recode";
215 recoderInfo.frame_nb = gpuMem->getFrameNb(); 215 recoderInfo.frame_nb = gpuMem->getFrameNb();
216 216
217 DecoderManager* pDecManager = DecoderManager::getInstance(); 217 DecoderManager* pDecManager = DecoderManager::getInstance();