Ver Fonte

#IQRV #comment 优化本地媒体播放实体日志

80274480 há 7 meses atrás
pai
commit
23a87aaab9

+ 2 - 2
Module/mod_interactivecontrol/mod_interactivecontrol.cpp

@@ -61,7 +61,7 @@ void CITCtrlEntity::OnAudioPlayRet(const char *pszEntityName, DWORD dwMessageId,
 	ret.ret = evt.ret;
 	ret.AudioNames = evt.AudioNames;
 	SpSendBroadcast(GetFunction(), eMsg_AudioEndRet, eMsgSig_AudioEndRet, ret);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
+	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
 }
 	
 
@@ -70,7 +70,7 @@ void CITCtrlEntity::OnEnvCameraCapInfo(const char* pszEntityName, DWORD dwMessag
 	EnvCameraCapProcess ret;
 	ret.envcapmsg = evt.cameracapmsg;
 	SpSendBroadcast(GetFunction(), eMsg_EnvCameraCapProcess, eMsgSig_EnvCameraCapProcess, ret);
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast EnvCameraCapProcess info is %s.", CSimpleStringW2A(ret.envcapmsg).GetData());
+	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast EnvCameraCapProcess info is %s.", CSimpleStringW2A(ret.envcapmsg).GetData());
 }
 
 CServerSessionBase* CITCtrlEntity::OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszParam*/)

+ 41 - 31
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -1174,8 +1174,9 @@ void CLocalMediaPlayEntity::OnStarted()
 	if (eStand2sType == m_eDeviceType) {
 #ifdef RVC_OS_WIN
 		m_scanThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&qryMedia, this, 0, NULL);
-		if (NULL != m_scanThread)
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create qryMeia thread success, %d.", m_scanThread);
+		if (NULL == m_scanThread) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create queryMedia thread failed.");
+		}
 #else
 		int err = pthread_create(&m_scanThreadId, NULL, queryMedia, this);
 		if (0 != err) {
@@ -1471,7 +1472,9 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						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());
+					if (blog) {
+						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!");
@@ -1506,7 +1509,9 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						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());
+					if (blog) {
+						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!");
@@ -1641,7 +1646,10 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 					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());
+				if (blog) {
+					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)) {
@@ -1672,7 +1680,9 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				}
 
 				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());
+					if (blog) {
+						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!");
@@ -1721,7 +1731,7 @@ void* StartAudioPlayingThreadFunc(void* param)
 
 	entity->m_uAudioPlayThreadId = 0;
 
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Exit Start Audio Playing Thread Function.");
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Exit Start Audio Playing Thread Function.");
 
 	return 0;
 }
@@ -1829,7 +1839,9 @@ void* StartMediaPlayFunc(void* param)
 					continue;
 				}
 
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin play extend %c:%s, %s", item.type, item.strResourcePath, item.strvideoNames);
+				if (blog) {
+					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;
@@ -1864,7 +1876,9 @@ void* StartMediaPlayFunc(void* param)
 				}
 
 				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);
+					if (blog) {
+						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!");
@@ -1958,7 +1972,7 @@ void CLocalMediaPlayEntity::StartVideo(int nCfgInx, int nWndX, int nWndY, int nW
 #ifdef RVC_OS_WIN
 		if (0 == m_iPlayType) {
 			if (NULL != m_playThread) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
 				StopVideo(nCfgInx);
 			}
 
@@ -1970,7 +1984,7 @@ void CLocalMediaPlayEntity::StartVideo(int nCfgInx, int nWndX, int nWndY, int nW
 		}
 		else {
 			if (NULL != m_uMediaPlayThreadId) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
 				StopVideo(nCfgInx);
 			}
 			m_hStopMediaPlayEvent = CreateEventA(NULL, false, false, NULL);
@@ -2083,7 +2097,7 @@ void CLocalMediaPlayEntity::StartImage(int nCfgInx, int nWndX, int nWndY, int nW
 #else
 		m_pPicturePlayer[nCfgInx]->Play(nCfgInx, nWndX, nWndY, nWndWidth, nWndHeight);
 #endif
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StartImage!");
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StartImage!");
 	}
 }
 
@@ -2105,7 +2119,7 @@ void CLocalMediaPlayEntity::StopVideo(int nCfgInx)
 				SetEvent(m_hStopMediaPlayEvent);
 				WaitForSingleObject(m_playThread, INFINITE);
 				m_playThread = NULL;
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopVideo!");
+				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopVideo!");
 				CloseHandle(m_hStopMediaPlayEvent);
 			}
 		} 
@@ -2116,7 +2130,7 @@ void CLocalMediaPlayEntity::StopVideo(int nCfgInx)
 				SetEvent(m_hStopMediaPlayEvent);
 				WaitForSingleObject(m_uMediaPlayThreadId, INFINITE);
 				m_uMediaPlayThreadId = NULL;
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopVideo!");
+				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopVideo!");
 				CloseHandle(m_hStopMediaPlayEvent);
 			}
 		}
@@ -2147,7 +2161,7 @@ void CLocalMediaPlayEntity::StopAudio()
 		m_buserstopaudio = true;
 		WaitForSingleObject(m_uAudioPlayThreadId, INFINITE);
 		m_uAudioPlayThreadId = NULL;
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopAudio!");
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopAudio!");
 	}
 #else
 	if (0 != m_uAudioPlayThreadId) {
@@ -2336,12 +2350,12 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartMediaPlayerNotice(int nCfgInx, int nWn
 {
 #ifdef RVC_OS_WIN
 	if (false == m_pAudioPlayer->checkIsStop()) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
 		StopAudio();
 	}
 
 	if (false == m_pVideoPlayer[nCfgInx]->checkIsStop()) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
 		StopNotice(nCfgInx);
 	}
 #endif // RVC_OS_WI
@@ -2388,9 +2402,9 @@ DWORD WINAPI StartNoticePlayThreadFunc(LPVOID param)
 {
 	int iRet = -1;
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter NoticePlayThreadFunc and process id is %u, thread id is %u.", GetCurrentProcessId(), GetCurrentThreadId());
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter NoticePlayThreadFunc and process id is %u, thread id is %u.", GetCurrentProcessId(), GetCurrentThreadId());
 	const char* pVideoName = entity->m_lastPlayVideo.c_str();
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Start Notice Play, and Video Notice Info is %s.", pVideoName);
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin Start Notice Play, and Video Notice Info is %s.", pVideoName);
 	int nCfgInx = entity->m_mediaParam.nCfgInx;
 	int nWndX = entity->m_mediaParam.nWndX;
 	int nWndY = entity->m_mediaParam.nWndY;
@@ -2406,7 +2420,7 @@ DWORD WINAPI StartNoticePlayThreadFunc(LPVOID param)
 		else {
 			WaitForSingleObject(playEndEvent, INFINITE);
 			if (entity->m_pVideoPlayer[nCfgInx]->checkIsStop()) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop notice play success.");
+				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop notice play success.");
 			}
 			else {
 				entity->m_pVideoPlayer[nCfgInx]->Close();
@@ -2417,8 +2431,8 @@ DWORD WINAPI StartNoticePlayThreadFunc(LPVOID param)
 		Clibmediaplayer* player = entity->m_pMediaPlayer[nCfgInx];
 		player->PlayVideoNotice(nWndX, nWndY, nWndWidth, nWndHeight, pVideoName);
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to Start Notice Play, and Video Notice Info is %s.", pVideoName);
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Leave NoticePlayThreadFunc");
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to Start Notice Play, and Video Notice Info is %s.", pVideoName);
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Leave NoticePlayThreadFunc");
 
 	entity->m_uNoticePlayThreadId = NULL;
 
@@ -2433,12 +2447,12 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartFFPlayerNotice(int nCfgInx, int nWndX,
 	ErrorCodeEnum Error = Error_Succeed;
 
 	if (m_pMediaAudioPlayer->checkIsPlay()) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
 		StopAudio();
 	}
 
 	if (m_pMediaPlayer[nCfgInx]->checkIsPlay()) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
 		StopNotice(nCfgInx);
 	}
 
@@ -2574,18 +2588,15 @@ ErrorCodeEnum CLocalMediaPlayEntity::StopPlayAllMedias()
 
 void CLocalMediaPlayEntity::OnSelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext)
 {
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d eTestType = %d.", __FUNCTION__, __LINE__, eTestType);
 	if (Test_ShakeHand == eTestType){
 		pTransactionContext->SendAnswer(Error_Succeed);
 	}
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d.", __FUNCTION__, __LINE__);
 }
 
 
 void CLocalMediaPlaySession::Handle_StartPlayVideo(SpReqAnsContext<PlayService_StartPlayVideo_Req, PlayService_StartPlayVideo_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start play Video, Index:%d, WndX:%d, WndY:%d, WndWidth:%d, WndWidth:%d", ctx->Req.CfgInx, ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight);
 	
 	CSimpleStringA UpdateState = "";
 	ErrorCodeEnum Error = m_pEntity->GetFunction()->GetSysVar("UpdateState", UpdateState);
@@ -2608,7 +2619,7 @@ void CLocalMediaPlaySession::Handle_StartPlayAudio(SpReqAnsContext<PlayService_S
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
 	CSimpleStringA AudioNames = CSimpleStringW2A(ctx->Req.AudioNames);
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start play audio, name:%s", AudioNames.GetData());
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start play audio, name:%s", AudioNames.GetData());
 
 	CSimpleStringA UpdateState = "";
 	ErrorCodeEnum Error = m_pEntity->GetFunction()->GetSysVar("UpdateState", UpdateState);
@@ -2634,7 +2645,6 @@ void CLocalMediaPlaySession::Handle_StartPlayImage(SpReqAnsContext<PlayService_S
 void CLocalMediaPlaySession::Handle_StopPlayVideo(SpReqAnsContext<PlayService_StopPlayVideo_Req, PlayService_StopPlayVideo_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
-	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop play Video, Index:%d", ctx->Req.CfgInx);
 	m_pEntity->StopVideo(ctx->Req.CfgInx);
 	ctx->Answer(Error_Succeed);
 }
@@ -2720,7 +2730,7 @@ void CLocalMediaPlaySession::Handle_StartPlayNotice(SpReqAnsContext<PlayService_
 	}
 
 	CSimpleStringA VideoName = CSimpleStringW2A(ctx->Req.VideoName);
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start play notice, CfgInx = %d, WndX = %d, WndY = %d, WndWidth = %d, WndHeight = %d, and video name is %s.", ctx->Req.CfgInx, ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight, VideoName.GetData());
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start play notice, CfgInx = %d, WndX = %d, WndY = %d, WndWidth = %d, WndHeight = %d, and video name is %s.", ctx->Req.CfgInx, ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight, VideoName.GetData());
 	Error = m_pEntity->StartNotice(ctx->Req.CfgInx, ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight, VideoName.GetData());
 	ctx->Answer(Error);
 }
@@ -2728,7 +2738,7 @@ void CLocalMediaPlaySession::Handle_StartPlayNotice(SpReqAnsContext<PlayService_
 void CLocalMediaPlaySession::Handle_StopPlayNotice(SpReqAnsContext<PlayService_StopPlayNotice_Req, PlayService_StopPlayNotice_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop play notice, Index:%d", ctx->Req.CfgInx);
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop play notice, Index:%d", ctx->Req.CfgInx);
 	ErrorCodeEnum Error = m_pEntity->StopNotice(ctx->Req.CfgInx);
 	ctx->Answer(Error);
 }