Browse Source

Z991239-5077 #comment 优化录像监控功能

80274480 1 year ago
parent
commit
0525e5156d

+ 2 - 0
Module/mod_recorder/CMakeLists.txt

@@ -3,6 +3,7 @@ define_module("recorder")
 
 set(${MODULE_PREFIX}_SRCS
 	${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_PLAFORM_SUBDIR}/mod_recorder.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/recordinfo.cpp
 )
 
 set(MOD_VERSION_STRING "1.0.0-dev1")
@@ -18,6 +19,7 @@ target_include_directories(${MODULE_NAME} PRIVATE
     ${OTHER_LIB_PLATFORM_BASE_DIR}/libvideorecord
     ${OTHER_LIB_PLATFORM_BASE_DIR}/rvcmediacommon
     ${OTHER_LIB_PLATFORM_BASE_DIR}/libfilecryption
+    ${CONAN_INCLUDE_DIRS_JSONCPP}
     )
 
 target_link_directories(${MODULE_NAME} PRIVATE

+ 21 - 7
Module/mod_recorder/mod_recorder.h

@@ -3,7 +3,6 @@
 #include "SpBase.h"
 #include "SpIni.h"
 #include "libvideorecord.h"
-#include "../../Other/rvcmediacommon/rvc_media_common.h"
 #include "EventCode.h"
 #if defined(RVC_OS_WIN)
 #include "fileutil.h"
@@ -36,7 +35,16 @@ namespace Recorder {
 	class CRecorderEntity : public CEntityBase, public CHostApi, public ILogListener, public ISysVarListener
 	{
 	public:
-		CRecorderEntity() : m_bStarted(false), m_pRecorder(NULL), m_eRecordType(eMP4){}
+		CRecorderEntity() : m_bStarted(false), m_pRecorder(NULL), m_LastSaveSessionId("N"), m_iSeriesNum(0), m_iMovedSeriesNum(0), m_bMoveFlag(false), m_bEncFlag(false), m_eRecordType(eMP4), m_iRecordMode(0){
+			m_strHttpServerAPI = RVC_UPLOAD_VIDEORECORDING_HTTP_API;
+			m_iHttpTimeOut = RVC_HTTPTIMEOUT;
+			m_strHttpServerAddr = NULL;
+			m_strAppVersion = NULL;
+			m_strTerminalId = NULL;
+			memset(m_strRecordName, 0, MAX_PATH);
+			m_eBusinessStatus = eInterrupt;
+		}
+
 		virtual ~CRecorderEntity() {}
 		virtual const char* GetEntityName() const { return "Recorder"; }
 
@@ -48,7 +56,6 @@ namespace Recorder {
 		ErrorCodeEnum __OnStart(ErrorCodeEnum preOperationError);
 		ErrorCodeEnum __OnClose(ErrorCodeEnum preOperationError);
 #if defined(RVC_OS_WIN)
-		virtual void OnStarted();
 		virtual void WmpDebug(const char* fmt, ...);
 #else
 		bool InitRecorder();
@@ -69,11 +76,7 @@ namespace Recorder {
 			const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
 			const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo);
 
-#if defined(RVC_OS_WIN)
-		void StartRecord(const char* wmvfilename);
-#else
 		void StartRecord(const char* videofilename);
-#endif //RVC_OS_WIN
 		void StopRecord();
 		bool GetStartFlag() { return m_bStarted; }
 		void SetRecordSessionID(const char* strRecordID);
@@ -84,6 +87,17 @@ namespace Recorder {
 		virtual void OnSelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext);
 
 		DeviceTypeEnum RvcGetDeviceType();
+		int HandleSaveVideoRecord(const char* videofilename);
+		int GetRecordVideoInfo(const char* videofilename, char* strSession, size_t uSessionLen, int* iSeriesNum, char* strFormat, size_t uFormatLen);
+		int HandleFinishedVideoRecord(const char* videofilename);
+		int SaveExceptionRecordVideos();
+		int HandleEncryptVideoRecord(const char* videofilename);
+		bool IsCurrentTerminalMathed();
+		int DeleteExceptionLogFiles();
+		ErrorCodeEnum LoadEntityConfig();
+		ErrorCodeEnum PostVideoRecordInfos();
+		ErrorCodeEnum AddToVideoRecordList(const char* videofilename);
+		ErrorCodeEnum HandleExceptionRecordVideos();
 
 	private:
 		DeviceTypeEnum m_eDeviceType;

+ 3 - 13
Module/mod_recorder/recordinfo.cpp

@@ -4,7 +4,7 @@
 
 
 void HttpsLogCallBack(const char* logtxt) {
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI("HttpsLogCallBack")("HttpsLogCallBack: %s.", logtxt);
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI("HttpsLogCallBack")("HttpsLogCallBack: %s.", logtxt);
 }
 
 
@@ -12,21 +12,17 @@ int post_video_recordinfo_list(video_record_info_t* pinfo, int itimeout, bool bp
 {
 	int iret = -1;
 	IHttpFunc* client = create_http(HttpsLogCallBack);
-
 	RecordInfoHTTPReq req;
 	req.m_timeOut = itimeout;
 	if (bprintdbg) {
 		req.m_printDbg = true;
 	}
-
 	const char* pData = pinfo->strServerURL.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strServerURL = %s.", pData);
 	if (pData) {
 		req.m_url = pData;
 	}
 
 	pData = pinfo->strAPI.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strAPI = %s.", pData);
 	if (pData) {
 		req.m_url.append(pData);
 	}
@@ -34,25 +30,21 @@ int post_video_recordinfo_list(video_record_info_t* pinfo, int itimeout, bool bp
 	Json::Value rootReq;
 
 	pData = pinfo->strTerminalNo.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strTerminalNo = %s.", pData);
 	if (pData) {
 		rootReq["terminal_no"] = pData;
 	}
 
 	pData = pinfo->strAppVersion.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strAppVersion = %s.", pData);
 	if (pData) {
 		rootReq["app_version"] = pData;
 	}
 
 	pData = pinfo->strRecordEndTime.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strRecordEndTime = %s.", pData);
 	if (pData) {
 		rootReq["upload_time"] = pData;
 	}
 
 	pData = pinfo->strRecordID.GetData();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strRecordID = %s.", pData);
 	if (pData) {
 		rootReq["video_serial_id"] = pData;
 	}
@@ -64,8 +56,6 @@ int post_video_recordinfo_list(video_record_info_t* pinfo, int itimeout, bool bp
 		item["file_name"] = it->file_name;
 		item["file_path"] = it->file_path;
 		item["file_length"] = it->file_length;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("file path = %s.", it->file_path.c_str());
-
 		rootReq["file_list"].append(item);
 	}
 
@@ -74,7 +64,7 @@ int post_video_recordinfo_list(video_record_info_t* pinfo, int itimeout, bool bp
 
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_reqContent is %s.", req.m_reqContent.c_str());
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true" : "false");
+	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true" : "false");
 
 	RecordInfoHTTPRet ret;
 	if (client->Post(req, ret)) {
@@ -83,7 +73,7 @@ int post_video_recordinfo_list(video_record_info_t* pinfo, int itimeout, bool bp
 		iret = 0;
 	}
 	else {
-		//LogWarn(Severity_Middle, Error_Exception, LOG_EVT_POST_RECORDINFO_FAILED, CSimpleStringA::Format("Post video record infos fail, url=%s, syscode=%d, usercode=%s, errmsg=%s", req.m_url.c_str(), ret.m_sysCode, ret.m_userCode.c_str(), ret.m_errMsg.c_str()).GetData());
+		LogWarn(Severity_Middle, Error_Exception, LOG_EVT_POST_RECORDINFO_FAILED, CSimpleStringA::Format("Post video record infos fail, url=%s, syscode=%d, usercode=%s, errmsg=%s", req.m_url.c_str(), ret.m_sysCode, ret.m_userCode.c_str(), ret.m_errMsg.c_str()).GetData());
 	}
 
 	return iret;

+ 0 - 8
Module/mod_recorder/recordinfo.h

@@ -64,24 +64,16 @@ struct RecordInfoHTTPRet : CHTTPRet {
 	bool	m_data;
 
 	virtual bool Parse(string strData) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GrayLaunchResponse: data = %s", strData.c_str());
 		Json::Value root;
 		Json::Reader reader;
 
 		if (reader.parse(strData, root, false)) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("reader parse success!");
 			m_success = root[REFLECTION(success)].asBool();
 			m_code = root[REFLECTION(code)].asString();
 			m_message = root[REFLECTION(message)].asString();
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_message = %s.", m_message.c_str());
 			m_returnCode = root[REFLECTION(returnCode)].asString();
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_returnCode = %s.", m_returnCode.c_str());
 			m_errorMsg = root[REFLECTION(errorMsg)].asString();
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_errorMsg = %s.", m_errorMsg.c_str());
 			m_data = root[REFLECTION(data)].asBool();
-			if (m_success) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("post video record info success!");
-			}
 		}
 		else {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("reader parse failed!");

+ 4 - 13
Module/mod_recorder/unix/mod_recorder.cpp

@@ -308,8 +308,11 @@ ErrorCodeEnum CRecorderEntity::LoadEntityConfig()
 	CSmartPointer<IConfigInfo> spConfig;
 	CSmartPointer<IEntityFunction> spFunction = GetFunction();
 	if (spFunction->OpenConfig(Config_CenterSetting, spConfig) == Error_Succeed) {
+
+#ifdef RVC_OS_WIN
 		spConfig->ReadConfigValueInt("Recorder", "Encryption", iEncrytion);
 		spConfig->ReadConfigValueHexInt("Recorder", "EncMtype", uMtype);
+#endif // RVC_OS_WIN
 		spConfig->ReadConfigValueInt("Recorder", "RecordType", iRecordType);
 		spConfig->ReadConfigValueInt("InteractiveControl", "RecordMode", iRecordMode);
 		spConfig->ReadConfigValue("Recorder", "http_video_record_addr", m_strHttpServerAddr);
@@ -324,10 +327,9 @@ ErrorCodeEnum CRecorderEntity::LoadEntityConfig()
 #ifdef RVC_OS_WIN
 	if (1 == iEncrytion && (uMtype & GetDeviceTypeValue(m_eDeviceType))) {
 		m_bEncFlag = true;
-}
+	}
 #endif // RVC_OS_WIN
 
-
 	if (1 == iRecordMode) {
 		m_iRecordMode = 1;
 	}
@@ -359,20 +361,11 @@ ErrorCodeEnum CRecorderEntity::PostVideoRecordInfos()
 	y2k_time_t nowtime = y2k_time_now();
 	y2k_to_string(nowtime, strtimenow, MAX_PATH);
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("time now is %s.", strtimenow);
-
 	video_record_info_t video_params;
 	video_params.strServerURL = m_strHttpServerAddr;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strServerURL is %s.", video_params.strServerURL.GetData());
-
 	video_params.strAPI = m_strHttpServerAPI;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strAPI is %s.", video_params.strAPI.GetData());
-
 	video_params.strAppVersion = m_strAppVersion;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strAppVersion is %s.", video_params.strAppVersion.GetData());
-
 	video_params.strRecordEndTime = strtimenow;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strRecordEndTime is %s.", video_params.strRecordEndTime.GetData());
 
 	video_params.strTerminalNo = m_strTerminalId;
 
@@ -384,8 +377,6 @@ ErrorCodeEnum CRecorderEntity::PostVideoRecordInfos()
 	}
 
 	video_params.strRecordID = m_strRecordName;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("strRecordID is %s.", video_params.strRecordID.GetData());
-
 	for (vector<record_item_t>::iterator it = m_vRecordList.begin(); it < m_vRecordList.end(); ++it) {
 		video_params.vRecordList.push_back(*it);
 	}

+ 14 - 14
Module/mod_sipphone/mod_sipphone.h

@@ -83,15 +83,15 @@ struct CFpsValue
 
 struct stVideoParam
 {
-	int nWindowState;	 //瑙嗛�绐楀彛鏄剧ず鐘舵€侊紝0锛氭�甯稿ぇ灏忔樉绀猴紝1锛氭斁澶т竴鍊嶆樉绀猴紝2锛氶殣钘忓叏閮ㄧ獥鍙o紝3:浠庨殣钘忕姸鎬佹仮澶嶄负鍏ㄩ儴鏄剧ず锛�4锛氭樉绀鸿繙绋嬬獥鍙o紝闅愯棌鏈�湴绐楀彛, 5锛氱缉鏀炬樉绀�
-	int bShowActiveImg;  //娲讳綋妫€娴嬫樉绀哄浘鐗�
-	int bActiveInspect;  //鏄�惁鍚�姩娲讳綋妫€娴�
+	int nWindowState;	 //视频窗口显示状态,0:正常大小显示,1:放大一倍显示,2:隐藏全部窗口,3:从隐藏状态恢复为全部显示,4:显示远程窗口,隐藏本地窗口, 5:缩放显示
+	int bShowActiveImg;  //活体检测显示图片
+	int bActiveInspect;  //是否启动活体检测
 	int iActiveCamera;	 // set by facetracking
 	int iCameraSwitch;	 // set by agent and camerastate
-	int nUpDynamicFps;	 // 褰撳墠瑙嗛�涓婅�鐨勫抚棰戯紝鐢卞悗绔�€氱煡鍓嶇�鏇存敼棰戠巼,鍙�湁绉诲姩鐗堟墠浣跨敤
+	int nUpDynamicFps;	 // 当前视频上行的帧频,由后端通知前端更改频率,只有移动版才使用
 	int iCameraState;	 // set by agent and camerastate
-	int bShowPersonArea; //鏄�惁鏄剧ず浜哄舰妗�
-	int bShowRecordArea; //鏄�惁鏄剧ず褰曞儚浜哄舰杞�粨
+	int bShowPersonArea; //是否显示人形框
+	int bShowRecordArea; //是否显示录像人形轮廓
 };
 
 
@@ -341,9 +341,9 @@ private:
 	void HandleAudioDeviceErrorEvent();
 	ErrorCodeEnum AutoCorrectAudioConfig();
 
-	//杞藉叆杩愯�鏃堕厤缃�
+	//载入运行时配置
 	ErrorCodeEnum LoadRestartRunConfig(unsigned int& utime);
-	//淇濆瓨杩愯�鏃�
+	//保存运行时
 	ErrorCodeEnum SaveRestartRunConfig(unsigned int utime);
 #else
 	void InitFreshTimeConfig();
@@ -354,9 +354,9 @@ private:
 #endif //RVC_OS_WIN
 	ErrorCodeEnum AudioDspFlagsUseCentersetting(endpoint_conf_t* conf);
 
-	//杞藉叆杩愯�鏃堕厤缃�
+	//载入运行时配置
 	ErrorCodeEnum LoadAudioRunConfig(int&nHandfreeout,int&nPickupout,int&nHandfreein,int&nPickupin);
-	//淇濆瓨杩愯�鏃�
+	//保存运行时
 	ErrorCodeEnum SaveAudioRunConfig(int nHandfreeout,int nPickupout,int nHandfreein,int nPickupin);
 	// we use root.ini Video section config to decide camera count
 	ErrorCodeEnum DecideCameraCount(int &nCount);
@@ -400,16 +400,16 @@ public:
 	rvc_video_render_t* m_render;
 	int m_iAudioDspUseCenter;
 #endif
-	//int m_nDownDynamicFps;	//褰撳墠瑙嗛�涓嬭�鐨勫抚棰戯紝鐢卞墠绔�€氱煡鍚庣�鏇存敼棰戠巼,鍙�湁绉诲姩鐗堟墠浣跨敤
+	
 	CSystemStaticInfo staticInfo;
-	char m_localip[RVC_MAX_IP_LEN];		//鏈�湴ip
+	char m_localip[RVC_MAX_IP_LEN];		//本地ip
 	endpoint_conf_t conf;
 	endpoint_t *m_pEndpoint;
 	int m_iPickupPhoneState;
 	ErrorCodeEnum m_SipErrorCode;
 	DeviceTypeEnum m_eDeviceType;
-	CallingTypeEnum m_nCallType;    //鍛煎彨妯″紡锛�0锛氬彲瑙嗘煖鍙版�甯稿懠鍙�紝1锛歅AD涓诲姩澶栧懠锛�2:PAD琚�姩鍛煎彨锛屾潵婧怭AD,3:PAD琚�姩鍛煎彨锛屾潵婧愭墜鏈虹
-	int m_nSysCallType;//0:鏅�€氭ā寮忥紝1锛歱2p妯″紡
+	CallingTypeEnum m_nCallType;    //呼叫模式,0:可视柜台正常呼叫,1:PAD主动外呼,2:PAD被动呼叫,来源PAD,3:PAD被动呼叫,来源手机端
+	int m_nSysCallType;				//0:普通模式,1:p2p模式
 	volatile stVideoParam m_stVideoParam;
 	volatile int m_bIsSalesRecord;
 	record_echo_location_t m_RecordVideoLocation;

+ 1 - 1
Other/unix/libvideorecord/libvideorecord_impl.cpp

@@ -761,7 +761,7 @@ bool libvideorecord_impl::GetRecordVideoFrameSize()
 			ts.tv_sec += (unsec / 1000000000);
 			ts.tv_nsec = (unsec % 1000000000);
 			if (0 != sem_timedwait(&m_semt, &ts) && (ETIMEDOUT == errno)) {
-				if (0 == i % 500) {
+				if (0 != i && 0 == i % 500) {
 					m_pHostApi->Debug(RECORD_LOG_ERROR, "GetDestTypeVideoFrameSize failed %d times.", i);
 				}
 			}