Bläddra i källkod

Z991239-5381 #comment 删除ST环境录像解密功能

80274480 1 år sedan
förälder
incheckning
b06635a7c5

+ 5 - 2
Module/mod_SalesRecorder/mod_SalesRecorder.cpp

@@ -1044,9 +1044,12 @@ ErrorCodeEnum CSalesRecorderEntity::SaveVideo( const char * videofilename)
 			uint32_t uVideoCount = 0;
 			CSimpleStringA strFindFileName = CSimpleStringA::Format("S_%s*.%s", videofilename, RECORD_MP4_SUFFIX);
 			bool bRet = FindMatchedFile(sourPath.GetData(), strFindFileName.GetData(), uVideoCount);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("FindMatchedFile count is %d.", uVideoCount);
 			if(bRet)
 			{
 				strFindFileName = strFindFileName.SubString(0,strFindFileName.GetLength()-5);
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("strFindFileName is %s.", strFindFileName);
+
 				CSimpleStringA destPath;
 				Error = GetFunction()->GetPath("UploadVideo", destPath);
 				if(Error == Error_Succeed)
@@ -1848,7 +1851,7 @@ int CSalesRecorderEntity::HandleEncryptVideoRecord(const char* videofilename)
 		return iRet;
 	}
 	else {
-		if (!rvcMoveFile(strOutFile, videofilename)) {
+		if (rvcMoveFile(strOutFile, videofilename)) {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("rename %s to %s Success!", strOutFile, videofilename);
 			iRet = 0;
 		}
@@ -1861,7 +1864,7 @@ int CSalesRecorderEntity::HandleEncryptVideoRecord(const char* videofilename)
 		}
 	}
 
-#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
+#if 0
 	char strdecFile[MAX_PATH] = { 0 };
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin decrypt file %s.", videofilename);
 	iresult = decryption_file(strdecFile, MAX_PATH, videofilename, &cb, eVerB);

+ 15 - 14
Module/mod_recorder/mod_recorder.cpp

@@ -32,6 +32,11 @@ using namespace Recorder;
 #define RVC_TRANSATCION_RECORD_SUFFIX "B_"
 #endif // !RVC_TRANSATCION_RECORD_SUFFIX
 
+#ifndef RVC_ENCRYPT_TRANSATCION_RECORD_SUFFIX
+#define RVC_ENCRYPT_TRANSATCION_RECORD_SUFFIX "enc_B_"
+#endif // !RVC_ENCRYPT_TRANSATCION_RECORD_SUFFIX
+
+
 static unsigned long GetFileSize(const char* pfilename)
 {
 #ifdef RVC_OS_WIN
@@ -373,8 +378,6 @@ ErrorCodeEnum CRecorderEntity::LoadEntityConfig()
 		m_strHttpServerAddr = strHttpServerAddr;
 	}
 
-	m_eRecordType = eMP4;
-
 	if (iTimeOut > 0 && iTimeOut < 20 * RVC_HTTPTIMEOUT) {
 		m_iHttpTimeOut = iTimeOut;
 	}
@@ -642,7 +645,7 @@ void CRecorderEntity::StartRecord(const char *videofilename)
 	tAudioParams.bIsTransOn = false;
 	tAudioParams.iAudioChannels = 1;
 
-	if (m_pRecorder->StartVideoRecord(fps, 75, m_eRecordType, &tAudioParams, NULL, false, true, m_TempDir.GetData(), m_RecordSaveDir.GetLength(), videofilename, strlen(videofilename)))
+	if (m_pRecorder->StartVideoRecord(fps, 75, eMP4, &tAudioParams, NULL, false, true, m_TempDir.GetData(), m_RecordSaveDir.GetLength(), videofilename, strlen(videofilename)))
 	{
 		m_bStarted = true;
 		m_eBusinessStatus = eSuccess;
@@ -789,7 +792,7 @@ int CRecorderEntity::HandleEncryptVideoRecord(const char* videofilename)
 		return iRet;
 	}
 	else{
-		if (!rvcMoveFile(strOutFile, videofilename)){
+		if (rvcMoveFile(strOutFile, videofilename)){
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("rename %s to %s Success!",strOutFile, videofilename);
 			iRet = 0;
 		}
@@ -802,7 +805,7 @@ int CRecorderEntity::HandleEncryptVideoRecord(const char* videofilename)
 		}
 	}
 
-#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
+#if 0
 	char strdecFile[MAX_PATH] = { 0 };
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin decrypt file %s.", videofilename);
 	iresult = decryption_file(strdecFile, MAX_PATH, videofilename, &cb, eVerB);
@@ -923,14 +926,9 @@ int CRecorderEntity::SaveExceptionRecordVideos()
 	HANDLE hFind;
 	bool fFinished = false;
 	char strVideoFormat[MAX_PATH] = { 0 };
-	if (eMP4 == m_eRecordType) {
-		_snprintf(strVideoFormat, MAX_PATH, "%s", RECORD_MP4_SUFFIX);
-	}
-	else {
-		_snprintf(strVideoFormat, MAX_PATH, "%s", RECORD_WMV_SUFFIX);                                                                                                                                                                                                                                                         
-	}
+	snprintf(strVideoFormat, MAX_PATH, "%s", RECORD_MP4_SUFFIX);
 
-	_snprintf(srcFilePath, MAX_PATH, "%s*.%s", m_TempDir.GetData(), strVideoFormat);
+	snprintf(srcFilePath, MAX_PATH, "%s*.%s", m_TempDir.GetData(), strVideoFormat);
 
 	hFind = FindFirstFile(srcFilePath, &FindFileData);
 
@@ -941,7 +939,8 @@ int CRecorderEntity::SaveExceptionRecordVideos()
 				goto on_next;
 			}
 
-			if (NULL == strstr(FindFileData.cFileName, "S_")){
+			if (0 == memcmp(FindFileData.cFileName, RVC_TRANSATCION_RECORD_SUFFIX, strlen(RVC_TRANSATCION_RECORD_SUFFIX)) ||
+				0 == memcmp(FindFileData.cFileName, RVC_ENCRYPT_TRANSATCION_RECORD_SUFFIX, strlen(RVC_ENCRYPT_TRANSATCION_RECORD_SUFFIX))){
 				CSimpleStringA srcfile = CSimpleStringA::Format("%s%s",m_TempDir.GetData(), FindFileData.cFileName);
 				if (m_bEncFlag){
 					filecryption_callback_t cb = {0};
@@ -968,7 +967,7 @@ int CRecorderEntity::SaveExceptionRecordVideos()
 				}
 
 				CSimpleStringA dstfile = CSimpleStringA::Format("%s%s",m_RecordSaveDir.GetData(), FindFileData.cFileName);
-				BOOL bRet = MoveFile(srcfile.GetData(), dstfile.GetData());
+				bool bRet = rvcMoveFile(srcfile.GetData(), dstfile.GetData());
 				if(!bRet) {
 					LogWarn(Severity_Low, Error_Debug, LOG_EVT_RECORDER_MOVE_FAILED, CSimpleStringA::Format("Error Code %u while move %s -> %s", GetLastError(), srcfile.GetData(), dstfile.GetData()).GetData());
 				}
@@ -990,6 +989,8 @@ on_next:
 		}
 		FindClose(hFind);
 	}
+#else
+
 #endif // RVC_OS_WIN
 
 	return iRet;

+ 1 - 2
Module/mod_recorder/mod_recorder.h

@@ -22,7 +22,7 @@ namespace Recorder {
 	class CRecorderEntity : public CEntityBase, public CHostApi, public ILogListener, public ISysVarListener
 	{
 	public:
-		CRecorderEntity() : m_bStarted(false), m_pRecorder(NULL), m_bEncFlag(true), m_eRecordType(eMP4){
+		CRecorderEntity() : m_bStarted(false), m_pRecorder(NULL), m_bEncFlag(true){
 			m_strHttpServerAPI = RVC_UPLOAD_VIDEORECORDING_HTTP_API;
 			m_iHttpTimeOut = RVC_HTTPTIMEOUT;
 			m_strHttpServerAddr = RVC_UPLOAD_VIDEORECORDING_HTTP_ADDR;
@@ -94,7 +94,6 @@ namespace Recorder {
 		CSimpleStringA m_TempDir;
 		CSimpleStringA m_RecordSaveDir;
 		bool m_bEncFlag;
-		eVideoFormat m_eRecordType;
 
 		CSimpleStringA m_strHttpServerAddr;
 		CSimpleStringA m_strHttpServerAPI;