Pārlūkot izejas kodu

Z991239-5511 #comment 优化广告播放流程

80274480 1 gadu atpakaļ
vecāks
revīzija
33e5251cab

+ 117 - 130
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -169,6 +169,30 @@ static bool IsValidPlayTime(const char* pstrStartTime, const char* pstrEndTime)
 	return bRet;
 }
 
+
+static bool CheckFileExist(const char* pstrFolder, const char* pstrFileName, bool blog)
+{
+	bool bret = false;
+	if (NULL == pstrFolder || NULL == pstrFileName) {
+		return bret;
+	}
+
+	CSimpleStringA strFolder(pstrFolder);
+	CSimpleStringA strFileName(pstrFileName);
+	CSimpleStringA strFullPath = strFolder + strFileName;
+
+	bret = ExistsFileA(strFullPath.GetData());
+
+	if (false == bret) {
+		if (blog) {
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_VIDEO_NOT_EXIST, CSimpleStringA::Format("adv file %s not exist!", strFullPath.GetData()).GetData());
+		}
+	}
+
+	return bret;
+}
+
+
 #ifdef RVC_OS_WIN
 DWORD WINAPI qryMedia(LPVOID lpv)
 {
@@ -1057,9 +1081,6 @@ void CLocalMediaPlayEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmar
 
 ErrorCodeEnum CLocalMediaPlayEntity::__OnStart(ErrorCodeEnum preOperationError)
 {
-	SetLogFlag(false);
-	SetLocalLogFlag(false);
-	SetLocalPicLogFlag(false);
 	m_eDeviceType = RvcGetDeviceType();
 
 	if (Error_Succeed != LoadEntityConfig()){
@@ -1329,6 +1350,8 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 {
 	CLocalMediaPlayEntity *entity = (CLocalMediaPlayEntity*)param;
 
+	static bool blog = true;
+
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter Windows Media Play Thread.");
 
 	while (entity->GetPlayFlag())
@@ -1355,17 +1378,12 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 				config.bPrimMonitor = true;
 			}
 
-			CSimpleStringA strVideoPath = config.strRootPath;
-			CSimpleStringA strVideoFileName = config.strFileNames[0];
-			CSimpleStringA strVideoFullPath = strVideoPath + strVideoFileName;
-			bool bRet = ExistsFileA(strVideoFullPath.GetData());
-			if (false == bRet && false == entity->GetLogFlag()){
-				LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_VIDEO_NOT_EXIST, CSimpleStringA::Format("adv video file %s not exist!", strVideoFullPath.GetData()).GetData());
-				entity->SetLogFlag(true);
+			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)){
+				break;
 			}
 
-			if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E) || false == bRet){
-				if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, DEFAULT_SLEEP_TIME)) {
+			if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)){
+				if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 30*DEFAULT_SLEEP_TIME)) {
 					continue;
 				}
 				else {
@@ -1376,7 +1394,7 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 			if (!entity->GetLocalVideoVolume(0, config.nVolume)){
 				config.nVolume = entity->m_defaultVolum;
 			}
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("config.nVolume=%d while play local video.", config.nVolume);
+
 			entity->m_pVideoPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 			if (!entity->m_pVideoPlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(playThread)){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get Play End Event Failed!");
@@ -1396,7 +1414,6 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 			for (vector<ResourceParse>::iterator i = curParse.begin(); i != curParse.end() && entity->GetPlayFlag(); i++)
 			{
 				HANDLE playThread = NULL;
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media] %c:%s, %s", i->type, i->resourcePath.c_str(), i->videoNames.c_str());
 				if ('V' == i->type)
 				{//video
 					CWmpPlayConfig config;
@@ -1419,10 +1436,10 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 					config.nWndHeight = entity->m_mediaParam.nWndHeight;
 					strncpy_s(config.strRootPath, i->resourcePath.c_str(), sizeof(config.strRootPath));
 					strncpy_s(config.strFileNames[0], i->videoNames.c_str(), 256);
-					strncpy_s(config.strVideoRunTime_S, "09:00:00", sizeof(config.strVideoRunTime_S));
-					strncpy_s(config.strVideoRunTime_E, "17:30:00", sizeof(config.strVideoRunTime_E));
+					strncpy_s(config.strVideoRunTime_S, RVC_VIDEOPLAY_START_TIME, sizeof(config.strVideoRunTime_S));
+					strncpy_s(config.strVideoRunTime_E, RVC_VIDEOPLAY_END_TIME, sizeof(config.strVideoRunTime_E));
 					if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)) {
-						if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 3000)) {
+						if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 30 * DEFAULT_SLEEP_TIME)) {
 							continue;
 						}
 						else {
@@ -1430,21 +1447,11 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						}
 					}
 
-					CSimpleStringA strVideoPath = config.strRootPath;
-					CSimpleStringA strVideoFileName = config.strFileNames[0];
-					CSimpleStringA strVideoFullPath = strVideoPath + strVideoFileName;
-					bool bRet = ExistsFileA(strVideoFullPath.GetData());
-					bool bFileValid = entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->IsFileValid(strVideoFullPath.GetData());
-
-					if (false == bRet && false == entity->GetLocalLogFlag()){
-						LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_VIDEO_NOT_EXIST, CSimpleStringA::Format("adv video file %s not exist!", strVideoFullPath.GetData()).GetData());
-						entity->SetLocalLogFlag(true);
-					}
-
-					if(false == bRet || false == bFileValid){
+					if(!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)){
 						continue;
 					}
 
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media] %c:%s, %s", i->type, i->resourcePath.c_str(), i->videoNames.c_str());
 					entity->m_pVideoPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 					if (!entity->m_pVideoPlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(playThread)){
 						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get Play End Event Failed!");
@@ -1475,19 +1482,11 @@ 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);
 
-					CSimpleStringA strPicPath = config.strRootPath;
-					CSimpleStringA strPicFileName = config.strFileNames[0];
-					CSimpleStringA strPicFullPath = strPicPath + strPicFileName;
-					bool bRet = ExistsFileA(strPicFullPath.GetData());
-					if (false == bRet && false == entity->GetLocalPicLogFlag()){
-						LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_PIC_NOT_EXIST, CSimpleStringA::Format("adv picture file %s not exist!", strPicFullPath.GetData()).GetData());
-						entity->SetLocalPicLogFlag(true);
-					}
-
-					if(false == bRet){
+					if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 						continue;
 					}
 
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media] %c:%s, %s", i->type, i->resourcePath.c_str(), i->videoNames.c_str());
 					entity->m_pImagePlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 					if (!entity->m_pImagePlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(playThread)){
 						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Create play Image Media Thread Failed!");
@@ -1508,9 +1507,10 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 
 		unsigned int uend_time = y2k_time_now();
 		if (uend_time - ustart_time < RVC_MIN_LOCALPLAYER_TIME) {
-			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIAPLAY_COST_TIME_ERROR, "广告播放错误,播放时长不足1秒");
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIAPLAY_COST_TIME_ERROR, "广告播放时长不足1秒");
 			break;
 		}
+		blog = false;
 	}
 
 	if (entity->m_badplayflag) {
@@ -1536,6 +1536,8 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter FFmpeg Media Play Function.");
 
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
+	static bool blog = true;
+
 	while (entity->GetPlayFlag())
 	{
 		vector<ResourceParse> curParse;
@@ -1562,29 +1564,27 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 			}
 
 			if(false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)){
-				if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 1000)) {
+				if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 30 * DEFAULT_SLEEP_TIME)) {
 					continue;
 				}
 				else {
 					break;
 				}
 			}
+
+			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				break;
+			}
+
 			if (-1 == entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config)){
-				if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 3000)) {
-					continue;
-				}
-				else {
-					break;
-				}
+				break;
 			}
 		}
 
 		for (int i = 0; i < curParse.size() && entity->GetPlayFlag(); i++)
 		{
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("ResourceList[%d] address is 0x%0x", i, ResourceList[i]);
 			HANDLE playThreadId = 0;
 			ResourceParse item = curParse[i];
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media%d] %c:%s, %s",i, item.type, item.resourcePath.c_str(), item.videoNames.c_str());
 			if ('V' == item.type)
 			{//video
 				CMediaPlayConfig config = {0};
@@ -1599,18 +1599,17 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 					config.nVolume = entity->m_defaultVolum;
 				}
 
-				//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("config.nVolume=%d while play local video.", config.nVolume);
 				config.nWndX = entity->m_mediaParam.nWndX;
 				config.nWndY = entity->m_mediaParam.nWndY;
 				config.nWndWidth = entity->m_mediaParam.nWndWidth;
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
 				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);
-				strncpy(config.strVideoRunTime_S, "09:00:00", sizeof(config.strVideoRunTime_S));
-				strncpy(config.strVideoRunTime_E, "17:30:00", sizeof(config.strVideoRunTime_E));
+				strncpy(config.strVideoRunTime_S, RVC_VIDEOPLAY_START_TIME, sizeof(config.strVideoRunTime_S));
+				strncpy(config.strVideoRunTime_E, RVC_VIDEOPLAY_END_TIME, sizeof(config.strVideoRunTime_E));
 				
 				if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)){
-					if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 3000)) {
+					if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, 30 * DEFAULT_SLEEP_TIME)) {
 						continue;
 					}
 					else {
@@ -1618,6 +1617,11 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 					}
 				}
 
+				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+					continue;
+				}
+
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media%d] %c:%s, %s", i, item.type, item.resourcePath.c_str(), item.videoNames.c_str());
 				int iPlayRet = entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 				if (-3 == iPlayRet) {
 					if (WAIT_TIMEOUT == WaitForSingleObject(entity->m_hStopMediaPlayEvent, DEFAULT_SLEEP_TIME)) {
@@ -1630,7 +1634,6 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 			}
 			else if ('P' == item.type)
 			{//play Image
-				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin new Image play, entity->m_mediaParam.nCfgInx = %d.", entity->m_mediaParam.nCfgInx);
 				CPicPlayConfig config = {0};
 				config.bFullScreen = IS_DEBUG ? false : item.fullScreen;
 				config.bPrimMonitor = IS_DEBUG ? true : false;
@@ -1643,16 +1646,19 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
 				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)) {
+					continue;
+				}
+
 				if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()){
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend [Media%d] %c:%s, %s", i, item.type, item.resourcePath.c_str(), item.videoNames.c_str());
 					entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 					if (!entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId)) {
 						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Create play Image Media Thread Failed!");
 						iRet = -1;
 						return iRet;
 					}
-					//else { 
-					//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Image Media Player Thread id is 0x%p.", playThreadId);
-					//}
 
 					WaitForSingleObject(playThreadId, INFINITE);
 					if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()){//停止播放
@@ -1667,9 +1673,10 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 		unsigned int uend_time = y2k_time_now();
 		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("uend_time - ustart_time = %u.", uend_time - ustart_time);
 		if (uend_time - ustart_time < RVC_MIN_LOCALPLAYER_TIME) {
-			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIAPLAY_COST_TIME_ERROR, "广告播放错误,播放时长不足1秒");
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIAPLAY_COST_TIME_ERROR, "广告播放时长不足1秒");
 			break;
 		}
+		blog = false;
 	}
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Leave Media Play Function.");
 
@@ -1705,9 +1712,11 @@ void* StartMediaPlayFunc(void* param)
 	if (NULL == param) {
 		return (void*)&iRet;
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter FFmpeg Media Play Function.");
+
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter FFmpeg Media Play Function.");
 
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
+	static bool blog = true;
 	while (entity->GetPlayFlag())
 	{
 		rvcResourceParse_t ResourceList[MAX_LOCAL_MEDIAS] = { 0 };
@@ -1737,7 +1746,7 @@ void* StartMediaPlayFunc(void* param)
 			if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)){
 				struct timespec ts;
 				clock_gettime(CLOCK_REALTIME, &ts);
-				ts.tv_sec += 10;
+				ts.tv_sec += 30;
 				int iresult = sem_timedwait(&entity->m_stop_mediaplay_semt, &ts);
 				if (0 != iresult && (ETIMEDOUT == errno)) {
 					continue;
@@ -1747,26 +1756,19 @@ void* StartMediaPlayFunc(void* param)
 				}
 			}
 
+			if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+				break;
+			}
+			
 			if (-1 == entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config)) {
-				struct timespec wait_time;
-				clock_gettime(CLOCK_REALTIME, &wait_time); 
-				wait_time.tv_sec += 30;
-				int iresult = sem_timedwait(&entity->m_stop_mediaplay_semt, &wait_time);
-				if (0 != iresult && (ETIMEDOUT == errno)) {
-					continue;
-				}
-				else {
-					break;
-				}
+				break;
 			}
 		}
 
 		for (int i = 0; i < uCount && i < MAX_LOCAL_MEDIAS && entity->GetPlayFlag(); i++)
 		{
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ResourceList[%d] address is 0x%0x", i, ResourceList[i]);
 			int64_t playThreadId = 0;
 			rvcResourceParse_t item = ResourceList[i];
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
 			if ('V' == item.type)
 			{//video
 				CMediaPlayConfig config = { 0 };
@@ -1787,13 +1789,13 @@ void* StartMediaPlayFunc(void* param)
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
 				strncpy(config.strRootPath, item.strResourcePath, strlen(item.strResourcePath));
 				strncpy(config.strFileNames[0], item.strvideoNames, strlen(item.strvideoNames));
-				strncpy(config.strVideoRunTime_S, "09:00:00", sizeof(config.strVideoRunTime_S));
-				strncpy(config.strVideoRunTime_E, "17:30:00", sizeof(config.strVideoRunTime_E));
+				strncpy(config.strVideoRunTime_S, RVC_VIDEOPLAY_START_TIME, sizeof(config.strVideoRunTime_S));
+				strncpy(config.strVideoRunTime_E, RVC_VIDEOPLAY_END_TIME, sizeof(config.strVideoRunTime_E));
 				
 				if (false == IsValidPlayTime(config.strVideoRunTime_S, config.strVideoRunTime_E)) {
 					struct timespec ts;
 					clock_gettime(CLOCK_REALTIME, &ts);
-					ts.tv_sec += 2;
+					ts.tv_sec += 30;
 
 					if (0 != sem_timedwait(&entity->m_stop_mediaplay_semt, &ts) && (ETIMEDOUT == errno)) {
 						continue;
@@ -1803,6 +1805,11 @@ void* StartMediaPlayFunc(void* param)
 					}
 				}
 
+				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
+					continue;
+				}
+
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
 				int iPlayRet = entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 				if (-3 == iPlayRet) {
 					struct timespec ts;
@@ -1831,7 +1838,13 @@ void* StartMediaPlayFunc(void* param)
 				config.nWndHeight = entity->m_mediaParam.nWndHeight;
 				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)) {
+					continue;
+				}
+
 				if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()) {
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
 					entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
 					if (!entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(&playThreadId)) {
 						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Create play Image Media Thread Failed!");
@@ -1853,10 +1866,13 @@ void* StartMediaPlayFunc(void* param)
 		if (uend_time - ustart_time < RVC_MIN_LOCALPLAYER_TIME) {
 			break;
 		}
+
+		blog = false;
 	}
+
 	entity->m_uMediaPlayThreadId = 0;
 	
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Leave FFmpeg Media Play Function.");
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Leave FFmpeg Media Play Function.");
 
 	return (void*)&iRet;
 }
@@ -1954,6 +1970,31 @@ void CLocalMediaPlayEntity::StartVideo(int nCfgInx, int nWndX, int nWndY, int nW
 
 void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 {
+	if (NULL != pAudioNames) {
+		char strAudios[MAX_PATH] = { 0 };
+		rvc_snprintf(strAudios, MAX_PATH, "%s", pAudioNames);
+		const char* d = "|";
+		char* pName = NULL;
+		char* pdata = NULL;
+#ifdef RVC_OS_WIN
+		pName = strtok_s(strAudios, d, &pdata);
+#else
+		pName = strtok_r(strAudios, d, &pdata);
+#endif
+		while (pName) {
+			CSimpleStringA strAudioFileName = pName;
+			CSimpleStringA strAudioFullPath = m_AudioPath + strAudioFileName;
+			if (!ExistsFileA(strAudioFullPath.GetData())) {
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_AUDIO_NOT_EXIST, CSimpleStringA::Format("audio file %s not exist!", strAudioFullPath.GetData()).GetData());
+				return;
+			}
+#ifdef RVC_OS_WIN
+			pName = strtok_s(NULL, d, &pdata);
+#else
+			pName = strtok_r(NULL, d, &pdata);
+#endif
+		}
+	}
 #ifdef RVC_OS_WIN
 	if (0 == m_iPlayType) {
 		static HANDLE audioPlayThread = NULL;
@@ -1966,24 +2007,6 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 			audioPlayThread = NULL;
 		}
 
-		if (NULL != pAudioNames) {
-			char strAudios[MAX_PATH] = { 0 };
-			_snprintf(strAudios, MAX_PATH, "%s", pAudioNames);
-			const char* d = "|";
-			char* pName = NULL;
-			char* pdata = NULL;
-			pName = strtok_s(strAudios, d, &pdata);
-			while (pName) {
-				CSimpleStringA strAudioFileName = pName;
-				CSimpleStringA strAudioFullPath = m_AudioPath + strAudioFileName;
-				if (!ExistsFileA(strAudioFullPath.GetData())) {
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_AUDIO_NOT_EXIST, CSimpleStringA::Format("audio file %s not exist!", strAudioFullPath.GetData()).GetData());
-					return;
-				}
-				pName = strtok_s(NULL, d, &pdata);
-			}
-		}
-
 		m_pAudioPlayer->PlayLocalAudio(pAudioNames);
 
 		auto audioRet = GetLocalAudioVolume();
@@ -2542,42 +2565,6 @@ ErrorCodeEnum CLocalMediaPlayEntity::StopPlayAllMedias()
 	return ErrorCode;
 }
 
-
-void CLocalMediaPlayEntity::SetLogFlag(bool bflag)
-{
-	m_bLogFlag = bflag;
-}
-
-
-bool CLocalMediaPlayEntity::GetLogFlag()
-{
-	return m_bLogFlag;
-}
-
-
-void CLocalMediaPlayEntity::SetLocalLogFlag(bool bflag)
-{
-	m_bLocalLogFlag = bflag;
-}
-
-
-bool CLocalMediaPlayEntity::GetLocalLogFlag()
-{
-	return m_bLocalLogFlag;
-}
-
-
-void CLocalMediaPlayEntity::SetLocalPicLogFlag(bool bflag)
-{
-	m_bLocalPicLogFlag = bflag;
-}
-
-
-bool CLocalMediaPlayEntity::GetLocalPicLogFlag()
-{
-	return m_bLocalPicLogFlag;
-}
-
 void CLocalMediaPlayEntity::OnSelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext)
 {
 	if (Test_ShakeHand == eTestType){

+ 0 - 14
Module/mod_localmediaplay/mod_localmediaplay.h

@@ -162,18 +162,6 @@ public:
 
 	ErrorCodeEnum StartFFPlayerNotice(int nCfgInx, int nWndX, int nWndY, int nWndWidth, int nWndHeight, const char *pVideoName);
 
-	void SetLogFlag(bool bflag);
-
-	bool GetLogFlag();
-
-	void SetLocalLogFlag(bool bflag);
-
-	bool GetLocalLogFlag();
-
-	void SetLocalPicLogFlag(bool bflag);
-
-	bool GetLocalPicLogFlag();
-
 	ErrorCodeEnum LoadEntityConfig();
 	
 	ErrorCodeEnum StopNotice(int nCfgInx);
@@ -250,8 +238,6 @@ private:
 	std::string m_lastPlayAudio;
 	std::string m_lastPlayVideo;
 	DeviceTypeEnum m_eDeviceType;
-	bool m_bLogFlag;
-	bool m_bLocalLogFlag;
 	CSimpleStringA m_AudioPath;
 	bool m_bLocalPicLogFlag;
 	bool m_bRecordPCM;

+ 1 - 2
Other/libmediaplayer/libmediaplayer.cpp

@@ -271,14 +271,13 @@ int libmediaplayer_impl::StartPlayLocalAudio(const char* pAudioNames)
 }
 
 
-
 int libmediaplayer_impl::StartPlayMedia(CMediaPlayConfig& config)
 {
 	int iRet = -1;
+
 	memcpy(&m_stPlayConfig, &config, sizeof(CMediaPlayConfig));
 
 	rvc_media_player_param_t t_param = { 0 };
-
 	t_param.eType = eVideo_Type;
 	t_param.m_eWindType = eFullScreen_Type;
 	t_param.bvicemonitor = !m_stPlayConfig.bPrimMonitor;