parent
24a6703ea6
commit
04d8dfbe68
|
|
@ -47,9 +47,7 @@ void ControlEngine::initParam()
|
|||
this->strDetectDate_ = "";
|
||||
for (int i = 0; i < this->vecDataSourceConfig_.size(); ++i)
|
||||
{
|
||||
this->mapDetectNO_[i] = 0;
|
||||
this->mapIdentifyType_[i] = IDENTIFY_INIT;
|
||||
|
||||
this->mapDetectNO_[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -64,10 +62,18 @@ void ControlEngine::endIdentify(int iDataSource)
|
|||
outputQueMap_[strPort1_]->push(std::static_pointer_cast<void>(pVDetectInfo), true);
|
||||
outputQueMap_[strPort2_]->push(std::static_pointer_cast<void>(pVDetectInfo), true);
|
||||
|
||||
this->mapDetectNO_[iDataSource] = 0;
|
||||
this->mapIdentifyType_[iDataSource] = IDENTIFY_INIT;
|
||||
this->mapDetectNO_[iDataSource] = 1;
|
||||
|
||||
LogInfo << " 数据源:" << iDataSource << " --- 识别结束!";
|
||||
bool bAllEnd = true;
|
||||
for (const auto & dataSource_it : this->mapDetectNO_)
|
||||
{
|
||||
if (dataSource_it.second != 1) bAllEnd = false;
|
||||
}
|
||||
if (bAllEnd)
|
||||
{
|
||||
g_identify_type = IDENTIFY_INIT;
|
||||
this->strDetectDate_ = "";
|
||||
}
|
||||
}
|
||||
|
||||
void ControlEngine::sendWSEngine(std::string msg)
|
||||
|
|
@ -77,19 +83,6 @@ void ControlEngine::sendWSEngine(std::string msg)
|
|||
outputQueMap_[strPort0_]->push(std::static_pointer_cast<void>(std::make_shared<std::string>(msg)));
|
||||
}
|
||||
|
||||
bool ControlEngine::isDetecting()
|
||||
{
|
||||
for (const auto & dataSource : this->mapIdentifyType_)
|
||||
{
|
||||
if (dataSource.second == IDENTIFY_START)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ControlEngine::detectControl(std::shared_ptr<std::string> pWSServerOrder)
|
||||
{
|
||||
Json::CharReaderBuilder readerBuilder;
|
||||
|
|
@ -123,25 +116,24 @@ void ControlEngine::detectControl(std::shared_ptr<std::string> pWSServerOrder)
|
|||
|
||||
switch (jvOrder["commandType"].asInt()) {
|
||||
case IDENTIFY_START:
|
||||
|
||||
if (this->isDetecting())
|
||||
if (g_identify_type == IDENTIFY_START)
|
||||
{
|
||||
std::string msg = "当前正在识别,无需重复发送识别信号";
|
||||
LogWarn << msg;
|
||||
this->sendWSEngine(msg);
|
||||
break;
|
||||
}
|
||||
this->mapIdentifyType_ = {{0, IDENTIFY_START}, {1, IDENTIFY_START}, {2, IDENTIFY_START}};
|
||||
g_identify_type = IDENTIFY_START;
|
||||
break;
|
||||
case IDENTIFY_STOP:
|
||||
if (!this->isDetecting())
|
||||
if (!g_identify_type)
|
||||
{
|
||||
std::string msg = "当前已停止识别,无需重复发送结束信号";
|
||||
LogWarn << msg;
|
||||
this->sendWSEngine(msg);
|
||||
break;
|
||||
}
|
||||
this->mapIdentifyType_ = {{0, IDENTIFY_INIT}, {1, IDENTIFY_INIT}, {2, IDENTIFY_INIT}};
|
||||
g_identify_type = IDENTIFY_INIT;
|
||||
break;
|
||||
case IDENTIFY_RECORD:
|
||||
if (!jvOrder.isMember("containerNo"))
|
||||
|
|
@ -189,36 +181,29 @@ APP_ERROR ControlEngine::Process()
|
|||
|
||||
if (pProcessData->bIsEnd)
|
||||
{
|
||||
if (!this->isDetecting()) continue;
|
||||
// 仅读是视频模式下会进行
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] == 1) continue;
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 画面读取结束:停止识别!";
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 视频画面播放结束:停止识别!";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this->isDetecting())
|
||||
if (!g_identify_type)
|
||||
{
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] > 0)
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] != 1)
|
||||
{
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
}
|
||||
this->strDetectDate_ = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->mapIdentifyType_[pProcessData->iDataSource] == IDENTIFY_INIT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] > this->identifyConfig_.iMaxIdentifyFrame)
|
||||
{
|
||||
LogInfo << " 数据源:" << pProcessData->iDataSource << " 超过最大允许识别帧数:" << this->identifyConfig_.iMaxIdentifyFrame << " 停止识别!";
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 超过最大允许识别帧数:" << this->identifyConfig_.iMaxIdentifyFrame << " 停止识别!";
|
||||
continue;
|
||||
}
|
||||
|
||||
this->mapDetectNO_[pProcessData->iDataSource]++;
|
||||
|
||||
cv::Mat image(pProcessData->dataSourceInfo.iHeight,
|
||||
pProcessData->dataSourceInfo.iWidth,
|
||||
CV_8UC3,
|
||||
|
|
@ -267,7 +252,7 @@ APP_ERROR ControlEngine::Process()
|
|||
pSaveImgData->bIsEnd = pProcessData->bIsEnd;
|
||||
outputQueMap_[strPort4_]->push(std::static_pointer_cast<void>(pSaveImgData), true);
|
||||
|
||||
|
||||
this->mapDetectNO_[pProcessData->iDataSource]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ private:
|
|||
|
||||
uint32_t iDetectNO_ = 1; //动态检测数据编号
|
||||
std::map<int, uint32_t> mapDetectNO_;
|
||||
std::map<int, int> mapIdentifyType_;
|
||||
|
||||
std::string strDetectDate_;
|
||||
std::string strDetectTime_;
|
||||
|
|
@ -46,7 +45,6 @@ private:
|
|||
void endIdentify(int iDataSource);
|
||||
void sendWSEngine(std::string msg);
|
||||
void detectControl(std::shared_ptr<std::string> pWSServerOrder);
|
||||
bool isDetecting();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -151,7 +151,7 @@ APP_ERROR VideoDecodeEngine::Process()
|
|||
}
|
||||
else
|
||||
{
|
||||
LogError << "数据源:" << pProcessData->iDataSource << " 硬解码失败... 返回失败信息:" << iDecodeRet;
|
||||
LogError << " 硬解码失败... 返回失败信息:" << iDecodeRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue