Commit 28eadcc464db1351ae68e3eeeb055ffd4e6f55ee
1 parent
10d335d7
修复进度值错误问题
Showing
4 changed files
with
28 additions
and
2 deletions
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/MutliSourceVideoProcess.cpp
... | ... | @@ -356,7 +356,7 @@ bool CMutliSourceVideoProcess::AddTask(task_param tparam) //debug by zsh |
356 | 356 | |
357 | 357 | new_task.taskState = PLAY; |
358 | 358 | new_task.taskFrameCount = 0; |
359 | - new_task.taskLastFrameCount = 0; | |
359 | + new_task.taskLastFrameCount = 1; | |
360 | 360 | |
361 | 361 | new_task.taskObjCallbackFunc = nullptr; |
362 | 362 | if (objCallbackFunc != nullptr) |
... | ... | @@ -684,6 +684,7 @@ void CMutliSourceVideoProcess::algorthim_process() |
684 | 684 | } |
685 | 685 | if(task.taskTotalFrameCount <= 1) { |
686 | 686 | task.taskTotalFrameCount = task.taskTcuvid->DxGetFrameCount(); |
687 | + m_snaphot_helper.update_taotal_frame_count(task.taskID, task.taskTotalFrameCount); | |
687 | 688 | } |
688 | 689 | |
689 | 690 | task.taskFrameCount = dxFrame.timestamp; | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.cpp
... | ... | @@ -196,6 +196,10 @@ void snapshot_helper::add_task_info(int new_task_id, TASK_INFO new_task_info) |
196 | 196 | m_task_info[new_task_id] = new_task_info; |
197 | 197 | } |
198 | 198 | |
199 | +void snapshot_helper::update_taotal_frame_count(int task_id, int total_frame_count) { | |
200 | + m_task_info[task_id].task_total_framecount = total_frame_count; | |
201 | +} | |
202 | + | |
199 | 203 | void snapshot_helper::delete_task_info(int new_task_id, TASK_INFO new_task_info) |
200 | 204 | { |
201 | 205 | m_task_info[new_task_id].image_folder = nullptr; | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/VPT/snapshot_analysis/snapshot_helper.h
... | ... | @@ -95,7 +95,7 @@ struct TASK_INFO { |
95 | 95 | char* snapshot_folder_face; |
96 | 96 | bool _on_image_display; |
97 | 97 | int jpeg_quality_; //debug by zsh |
98 | - int task_total_framecount; | |
98 | + int task_total_framecount{1}; | |
99 | 99 | SNAPSHOT_CALLBACK obj_callback; |
100 | 100 | |
101 | 101 | //TASK_INFO() :image_folder(NULL), snapshot_folder(NULL), snapshot_folder_face(NULL),_on_image_display(true), obj_callback(nullptr) {} |
... | ... | @@ -172,6 +172,8 @@ public: |
172 | 172 | void snapshot_helper_release(); |
173 | 173 | void add_task_info(int new_task_id, TASK_INFO new_task_info); |
174 | 174 | void delete_task_info(int new_task_id, TASK_INFO new_task_info); |
175 | + | |
176 | + void update_taotal_frame_count(int new_task_id, int total_frame_count); | |
175 | 177 | |
176 | 178 | int SaveResultInFile(OBJ_KEY deleteObj); |
177 | 179 | ... | ... |
vehicle_structure_platform.git0708-3080-trt-face/src/test/main.cpp
... | ... | @@ -672,6 +672,8 @@ void log_all(void * userPtr, int log_level, const char* log, unsigned int logLen |
672 | 672 | void *handle; |
673 | 673 | static int total_index = 0; |
674 | 674 | |
675 | +static bool bExit = false; | |
676 | + | |
675 | 677 | void create_task(const char * videoFileName, int total_index) { |
676 | 678 | //指定检测目标视频抽帧图片(保存时显存占用很大) |
677 | 679 | char resultFolder[256]; |
... | ... | @@ -712,6 +714,21 @@ void create_task(const char * videoFileName, int total_index) { |
712 | 714 | cur_task_status_.insert(make_pair(newTaskID, FALSE)); |
713 | 715 | } |
714 | 716 | |
717 | + | |
718 | +static void print_progress() { | |
719 | + while (!bExit) | |
720 | + { | |
721 | + for (auto it = cur_task_status_.begin(); it != cur_task_status_.end(); it++) | |
722 | + { | |
723 | + double progress = 0; | |
724 | + get_task_progress(handle, it->first, progress); | |
725 | + cout << "task " << it->first << " progress: " << progress << endl; | |
726 | + } | |
727 | + std::this_thread::sleep_for(std::chrono::seconds(1)); | |
728 | + } | |
729 | +} | |
730 | + | |
731 | + | |
715 | 732 | int main(int argc, char* argv[]) |
716 | 733 | { |
717 | 734 | if (argc<4) |
... | ... | @@ -767,6 +784,8 @@ int main(int argc, char* argv[]) |
767 | 784 | |
768 | 785 | int time_count = 0; |
769 | 786 | |
787 | + thread print_progress_trd(print_progress); | |
788 | + | |
770 | 789 | printf("begin add task\n"); |
771 | 790 | do { |
772 | 791 | if(get_running_task_number(handle) > 0){ | ... | ... |