|
@@ -4,7 +4,7 @@
|
|
* @Autor: lishengyin
|
|
* @Autor: lishengyin
|
|
* @Date: 2021-10-13 09:35:37
|
|
* @Date: 2021-10-13 09:35:37
|
|
* @LastEditors: lishengyin
|
|
* @LastEditors: lishengyin
|
|
- * @LastEditTime: 2022-01-04 16:12:54
|
|
|
|
|
|
+ * @LastEditTime: 2022-01-05 09:23:06
|
|
*/
|
|
*/
|
|
#include "inference.h"
|
|
#include "inference.h"
|
|
|
|
|
|
@@ -55,8 +55,6 @@ std::shared_ptr<InferInfo> g_InferInfo = NULL;
|
|
|
|
|
|
map<string, map<int, queue<std::shared_ptr<cv::Mat>>>> m_frames;
|
|
map<string, map<int, queue<std::shared_ptr<cv::Mat>>>> m_frames;
|
|
|
|
|
|
-bool RecordEnable = false;
|
|
|
|
-
|
|
|
|
namespace MIVA{
|
|
namespace MIVA{
|
|
std::shared_ptr<Inference> infer = NULL;
|
|
std::shared_ptr<Inference> infer = NULL;
|
|
ThreadPool pool(2,ThreadPool::PRIORITY_HIGHEST, false);
|
|
ThreadPool pool(2,ThreadPool::PRIORITY_HIGHEST, false);
|
|
@@ -81,7 +79,6 @@ namespace MIVA{
|
|
GstState state;
|
|
GstState state;
|
|
gst_element_get_state(this->pipeline,&state,NULL, GST_CLOCK_TIME_NONE);
|
|
gst_element_get_state(this->pipeline,&state,NULL, GST_CLOCK_TIME_NONE);
|
|
if(state == GST_STATE_PLAYING) gst_element_set_state(this->pipeline, GST_STATE_PAUSED);
|
|
if(state == GST_STATE_PLAYING) gst_element_set_state(this->pipeline, GST_STATE_PAUSED);
|
|
- this->m_InferInfo = NULL;
|
|
|
|
gst_element_set_state(this->pipeline, GST_STATE_NULL);
|
|
gst_element_set_state(this->pipeline, GST_STATE_NULL);
|
|
g_main_loop_quit (this->loop);
|
|
g_main_loop_quit (this->loop);
|
|
DebugL << "Deleting pipeline";
|
|
DebugL << "Deleting pipeline";
|
|
@@ -89,6 +86,7 @@ namespace MIVA{
|
|
g_source_remove(this->bus_watch_id);
|
|
g_source_remove(this->bus_watch_id);
|
|
g_main_loop_unref(this->loop);
|
|
g_main_loop_unref(this->loop);
|
|
g_mutex_clear (&eos_lock);
|
|
g_mutex_clear (&eos_lock);
|
|
|
|
+ this->m_InferInfo = NULL;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @description: 推理模块初始化
|
|
* @description: 推理模块初始化
|
|
@@ -195,13 +193,11 @@ namespace MIVA{
|
|
// g_object_set (G_OBJECT (this->tiler), "rows", this->tiler_rows, "columns", this->tiler_columns,
|
|
// g_object_set (G_OBJECT (this->tiler), "rows", this->tiler_rows, "columns", this->tiler_columns,
|
|
// "width", TILED_OUTPUT_WIDTH, "height", TILED_OUTPUT_HEIGHT, NULL);
|
|
// "width", TILED_OUTPUT_WIDTH, "height", TILED_OUTPUT_HEIGHT, NULL);
|
|
|
|
|
|
-
|
|
|
|
g_object_set (G_OBJECT (this->nvosd), "process-mode", OSD_PROCESS_MODE,
|
|
g_object_set (G_OBJECT (this->nvosd), "process-mode", OSD_PROCESS_MODE,
|
|
"display-text", OSD_DISPLAY_TEXT, NULL);
|
|
"display-text", OSD_DISPLAY_TEXT, NULL);
|
|
-
|
|
|
|
|
|
+ g_object_set (G_OBJECT (this->nvosd), "display-bbox", 0, NULL);
|
|
g_object_set (G_OBJECT (this->sink), "qos", 0, NULL);
|
|
g_object_set (G_OBJECT (this->sink), "qos", 0, NULL);
|
|
|
|
|
|
-
|
|
|
|
this->bus = gst_pipeline_get_bus (GST_PIPELINE (this->pipeline));
|
|
this->bus = gst_pipeline_get_bus (GST_PIPELINE (this->pipeline));
|
|
this->bus_watch_id = gst_bus_add_watch (this->bus, bus_call, this->loop);
|
|
this->bus_watch_id = gst_bus_add_watch (this->bus, bus_call, this->loop);
|
|
gst_object_unref (this->bus);
|
|
gst_object_unref (this->bus);
|
|
@@ -432,14 +428,15 @@ namespace MIVA{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if(RecordEnable){
|
|
|
|
|
|
+ recorder::Ptr m_recorder = recorder::CreateNew();
|
|
|
|
+
|
|
|
|
+ if(m_recorder->RecordEnable){
|
|
if(src_data == NULL) {
|
|
if(src_data == NULL) {
|
|
src_data = (char*) malloc(surface->surfaceList[frame_meta->batch_id].dataSize);
|
|
src_data = (char*) malloc(surface->surfaceList[frame_meta->batch_id].dataSize);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#ifdef PLATFORM_TEGRA
|
|
#ifdef PLATFORM_TEGRA
|
|
- if(src_data != NULL && RecordEnable){
|
|
|
|
|
|
+ if(src_data != NULL && m_recorder->RecordEnable){
|
|
NvBufSurfaceMap(surface, -1, -1, NVBUF_MAP_READ);
|
|
NvBufSurfaceMap(surface, -1, -1, NVBUF_MAP_READ);
|
|
unsigned int offset = 0;
|
|
unsigned int offset = 0;
|
|
for (unsigned int num_planes = 0; num_planes < pParams->num_planes; num_planes++)
|
|
for (unsigned int num_planes = 0; num_planes < pParams->num_planes; num_planes++)
|
|
@@ -468,8 +465,8 @@ namespace MIVA{
|
|
gint frame_step = surface->surfaceList[frame_meta->batch_id].pitch;
|
|
gint frame_step = surface->surfaceList[frame_meta->batch_id].pitch;
|
|
|
|
|
|
int flag = 1;
|
|
int flag = 1;
|
|
- if(!RecordEnable || src_data == NULL) flag = 0;
|
|
|
|
- if(RecordEnable){
|
|
|
|
|
|
+ if(!m_recorder->RecordEnable || src_data == NULL) flag = 0;
|
|
|
|
+ if(m_recorder->RecordEnable){
|
|
if(m_frames[g_InferInfo->DataSources[frame_meta->source_id].Pid][frame_meta->source_id].size() != 0) flag = 0;
|
|
if(m_frames[g_InferInfo->DataSources[frame_meta->source_id].Pid][frame_meta->source_id].size() != 0) flag = 0;
|
|
}
|
|
}
|
|
|
|
|