一些优化,待测试,Readme编写
This commit is contained in:
Binary file not shown.
@@ -2,9 +2,8 @@
|
||||
本程序用于设备验证
|
||||
验证通过执行以下功能:
|
||||
1.启动RTSP推流
|
||||
2.启动系统各项服务,用于和双目交互
|
||||
2.启动上传服务,用于上传最新报警图片
|
||||
3.启动mqtt,与App进行数据交互
|
||||
|
||||
认证失败则会退出程序
|
||||
*/
|
||||
|
||||
@@ -18,6 +17,8 @@
|
||||
#include <boost/process.hpp>
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#include "Netra.hpp"
|
||||
#include "NetRequest.hpp"
|
||||
@@ -48,6 +49,8 @@ const int Qos = 1;
|
||||
|
||||
std::atomic<bool> isRunning(true); // 全局运行标志
|
||||
std::atomic<bool> confirm(true); // 发送卡和ID
|
||||
condition_variable runCv;
|
||||
mutex runMutex;
|
||||
|
||||
// 媒体对象
|
||||
struct Media
|
||||
@@ -120,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
// 初始化mqtt
|
||||
mqttInit();
|
||||
|
||||
// 开启系统服务
|
||||
// 开启系统服务(上传图片服务)
|
||||
thread(StartService).detach();
|
||||
|
||||
// 开启推流服务器
|
||||
@@ -130,10 +133,14 @@ int main(int argc, char *argv[])
|
||||
// 进行RTSP视频推流
|
||||
thread video(VideoStream);
|
||||
|
||||
while (isRunning)
|
||||
{
|
||||
this_thread::sleep_for(1s); // 防止mpu沾满
|
||||
}
|
||||
unique_lock<mutex> lk(runMutex);
|
||||
runCv.wait(lk, []()
|
||||
{ return !isRunning; });
|
||||
|
||||
// while (isRunning)
|
||||
// {
|
||||
// this_thread::sleep_for(1s);
|
||||
// }
|
||||
|
||||
// Processing.join();
|
||||
video.join();
|
||||
@@ -372,7 +379,7 @@ void OpenRTSP()
|
||||
rtsp_proc = bp::child("/bin/bash", bp::args = {"-c", commnd});
|
||||
}
|
||||
|
||||
// 视频推流
|
||||
// 视频推流:推流桌面
|
||||
void VideoStream()
|
||||
{
|
||||
// 静音ffmpeg的统计输出,保留错误;避免污染日志
|
||||
|
||||
Reference in New Issue
Block a user