Browse Source

Z991239-6447 #comment 优化本地播放实体告警信息

80274480 1 month ago
parent
commit
8c00f3520c
2 changed files with 20 additions and 17 deletions
  1. 1 3
      Module/mod_localmediaplay/Event.h
  2. 19 14
      Module/mod_localmediaplay/mod_localmediaplay.cpp

+ 1 - 3
Module/mod_localmediaplay/Event.h

@@ -15,7 +15,5 @@
 #define LOG_EVT_PLAYING_AUDIO_INFOS			0x3130010B
 #define LOG_EVT_NOTICE_FILE_NOT_VALID		0x3130010C
 
-#define LOG_EVT_ADV_PLAYLIST_INFO			0x3130010E
-#define LOG_EVT_NOTSUPPORT_AUDIOFORMAT		0x3130010F
-#define LOG_EVT_ADV_PLAYLIST_VALIDTIME		0x31300110
+#define LOG_EVT_NOTSUPPORT_AUDIOFORMAT		0x31300110
 #define LOG_EVT_LOCALMEDIAPLAY_VOLUME		0x31300111

+ 19 - 14
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -203,7 +203,7 @@ static bool IsValidPlayTime(const char* pstrStartTime, const char* pstrEndTime)
 }
 
 
-static bool CheckFileExist(const char* pstrFolder, const char* pstrFileName, bool blog)
+static bool IsDestFileExist(const char* pstrFolder, const char* pstrFileName, bool blog)
 {
 	bool bret = false;
 	if (NULL == pstrFolder || NULL == pstrFileName) {
@@ -402,11 +402,15 @@ void CLocalMediaPlayEntity::WmpDebug(const char *fmt, ...)
 
 void CLocalMediaPlayEntity::WmpLogEvt(int ievent, const char* strmsg)
 {
+	static bool bloged = false;
 	if (0 == ievent){
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_VICE_MONITOR_NOT_EXIST, strmsg);
 	}
 	else if(1 == ievent){
-		LogWarn(Severity_Low, Error_Debug, LOG_EVT_VICE_MONITOR_SET_ERROR, strmsg);
+		if (false == bloged) {
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_VICE_MONITOR_SET_ERROR, strmsg);
+			bloged = true;
+		}
 	}
 }
 
@@ -1355,7 +1359,7 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 				config.bPrimMonitor = true;
 			}
 
-			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)){
+			if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)){
 				break;
 			}
 
@@ -1424,7 +1428,7 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						}
 					}
 
-					if(!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)){
+					if(!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)){
 						continue;
 					}
 
@@ -1458,7 +1462,7 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 					strncpy_s(config.strRootPath, i->resourcePath.c_str(), sizeof(config.strRootPath));
 					strncpy_s(config.strFileNames[0], i->videoNames.c_str(), 256);
 
-					if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+					if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 						continue;
 					}
 
@@ -1543,7 +1547,7 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				}
 			}
 
-			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+			if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 				break;
 			}
 
@@ -1588,7 +1592,7 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 					}
 				}
 
-				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 					continue;
 				}
 				
@@ -1617,7 +1621,7 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				strncpy(config.strRootPath, item.resourcePath.c_str(), item.resourcePath.length() < MAX_PATH ? item.resourcePath.length() : MAX_PATH);
 				strncpy(config.strFileNames[0], item.videoNames.c_str(), item.videoNames.length() < MAX_PATH ? item.videoNames.length() : MAX_PATH);
 				
-				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 					continue;
 				}
 
@@ -1643,9 +1647,10 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 		if (uend_time - ustart_time < RVC_MIN_LOCALPLAYER_TIME) {
 			break;
 		}
-		blog = false;
 	}
 
+	blog = false;
+
 	if (entity->m_badplayflag) {
 		entity->m_badplayflag = false;
 	}
@@ -1718,7 +1723,7 @@ void* StartMediaPlayFunc(void* param)
 				}
 			}
 
-			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+			if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 				break;
 			}
 			
@@ -1767,7 +1772,7 @@ void* StartMediaPlayFunc(void* param)
 					}
 				}
 
-				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 					continue;
 				}
 
@@ -1800,7 +1805,7 @@ void* StartMediaPlayFunc(void* param)
 				strncpy(config.strRootPath, item.strResourcePath, strlen(item.strResourcePath));
 				strncpy(config.strFileNames[0], item.strvideoNames, strlen(item.strvideoNames));
 
-				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				if (!IsDestFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 					continue;
 				}
 
@@ -1826,10 +1831,10 @@ void* StartMediaPlayFunc(void* param)
 		if (uend_time - ustart_time < RVC_MIN_LOCALPLAYER_TIME) {
 			break;
 		}
-
-		blog = false;
 	}
 
+	blog = false;
+
 	entity->m_uMediaPlayThreadId = 0;
 
 	return (void*)&iRet;