Browse Source

Z991239-6004 #comment 优化本地媒体播放实体日志

80274480 8 tháng trước cách đây
mục cha
commit
6a2fa9a276
1 tập tin đã thay đổi với 13 bổ sung81 xóa
  1. 13 81
      Module/mod_localmediaplay/mod_localmediaplay.cpp

+ 13 - 81
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -319,8 +319,8 @@ CLocalMediaPlayEntity::~CLocalMediaPlayEntity()
 	}
 #else
 	m_scanexitflag = true;
-	if (0 == pthread_join(m_scanThreadId, NULL)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pthread join scanThreadId success.");
+	if (0 != pthread_join(m_scanThreadId, NULL)) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pthread join scanThreadId failed.");
 	}
 	m_bgetflag = false;
 	m_bgetico = false;
@@ -455,7 +455,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Fail to get local media root path!");
 		return;
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("local media root path is %s.", strRootPath.GetData());
 
 	CSmartPointer<IConfigInfo> spConfigCen;
 	if (Error_Succeed == GetFunction()->OpenConfig(Config_CenterSetting, spConfigCen)) {
@@ -485,7 +484,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 				removeOldTime = value;
 			}
 		} while (false);
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("runDebug:%s, scanTime:%d", IS_DEBUG ? "true" : "false", scanTime);
 	}
 
 	CSimpleStringA imgPath = strRootPath + SPLIT_SLASH_STR + "Image" + SPLIT_SLASH_STR;
@@ -622,7 +620,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 			CWmpPlayConfig curVideo;
 			ZeroMemory(&curVideo, sizeof(CWmpPlayConfig));
 			strcpy(curVideo.strRootPath, videoPath.GetData());
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("config.strRootPath: %s", curVideo.strRootPath);
 
 			curVideo.bFullScreen = true;
 			curVideo.bPrimMonitor = false;
@@ -703,56 +700,6 @@ void CLocalMediaPlayEntity::loadDefaultMedia(bool fNewVersion)
 			m_Audios.push_back(curAudio1);
 		}
 	} while (false);
-
-#ifdef RVC_OS_WIN
-	for (vector<CWmpPlayConfig>::iterator i = m_defaultVideo.begin(); i != m_defaultVideo.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_defaultVideo %s.", i->strFileNames[index]);
-			}
-		}
-	}
-
-	for (vector<CWmpPlayConfig>::iterator i = m_defaultAudio.begin(); i != m_defaultAudio.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_defaultAudio %s.", i->strFileNames[index]);
-			}
-		}
-	}
-	
-	for (vector<CImgPlayConfig>::iterator i = m_defaultImg.begin(); i != m_defaultImg.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_defaultImg %s.", i->strFileNames[index]);
-			}
-		}
-	}
-#endif
-
-	for (vector<CMediaPlayConfig>::iterator i = m_Videos.begin(); i != m_Videos.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_Videos %s.", i->strFileNames[index]);
-			}
-		}
-	}
-
-	for (vector<CMediaPlayConfig>::iterator i = m_Audios.begin(); i != m_Audios.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_Audios %s.", i->strFileNames[index]);
-			}
-		}
-	}
-
-	for (vector<CPicPlayConfig>::iterator i = m_defaultPic.begin(); i != m_defaultPic.end(); i++) {
-		for (int index = 0; index < MAX_FILECOUNT; index++) {
-			if (strlen(i->strFileNames[index])) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_defaultPic %s.", i->strFileNames[index]);
-			}
-		}
-	}
 }
 
 
@@ -842,17 +789,16 @@ void CLocalMediaPlayEntity::MediaPlayFinished(int iMediaType)
 		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop play audio %s success.", ret.AudioNames.GetData());
 		if (false == m_buserstopaudio) {
 			SpSendBroadcast(GetFunction(), eMsg_AudioPlayRet, eMsgSig_AudioPlayRet, ret);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("user stop, not broadcast!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("user stop, not broadcast!");
 		}
 	}
 	else {
 		VideoPlayRet ret;
 		ret.VideoNames = m_lastPlayVideo.c_str();
 		ret.ret = true;
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop play video notice %s success.", ret.VideoNames.GetData());
 		SpSendBroadcast(GetFunction(), eMsg_VideoPlayRet, eMsgSig_VideoPlayRet, ret);
 	}
 }
@@ -872,7 +818,6 @@ int CLocalMediaPlayEntity::GetAudioOutDevName(char* strDev, int iLen)
 		iRet = 0;
 		if (false == m_bgetflag) {
 			m_bgetflag = true;
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d audio Out Device Name is %s.", __FUNCTION__, __LINE__, strDev);
 		}
 	}
 
@@ -893,7 +838,6 @@ int CLocalMediaPlayEntity::PlayingAudioDataCallback(audio_param_t* param, const
 			}
 		}
 
-		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s:%d uaudiolen:%d", __FUNCTION__, __LINE__, uaudiolen);
 		//AV_SAMPLE_FMT_S16 == 1
 		if (1 == param->fmt) {	
 			int isingle_audioframe_len = param->bytes_per_sec/50;
@@ -1008,7 +952,6 @@ int CLocalMediaPlayEntity::GetPlayerIcoPath(char* strPath, int iLen)
 	CSimpleStringA szIcoName("rvc_media_player_64px.bmp");
 	szIcoName = csBinPath + SPLIT_SLASH_STR + szIcoName;
 	if (m_bgetico == false) {
-		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("media player ico full path is %s.", szIcoName.GetData());
 		m_bgetico = true;
 	}
 
@@ -1037,6 +980,7 @@ int CLocalMediaPlayEntity::GetAudioOutDev()
 			iRet = 0;
 		}
 	}
+
 	return iRet;
 }
 
@@ -1302,7 +1246,7 @@ DWORD WINAPI StartAudioPlayingThreadFunc(LPVOID param)
 		else {
 			WaitForSingleObject(playEndEvent, INFINITE);
 			if (entity->m_pAudioPlayer->checkIsStop()) {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop audio play success.");
+				//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop audio play success.");
 			}
 			else {
 				entity->m_pAudioPlayer->Close();
@@ -1353,10 +1297,10 @@ DWORD WINAPI NoticePlayThread(LPVOID param)
 		ret.VideoNames = entity->m_lastPlayVideo.c_str();
 		ret.ret = true;
 		SpSendBroadcast(entity->GetFunction(), eMsg_VideoPlayRet, eMsgSig_VideoPlayRet, ret);
-		LogWarn(Severity_Low, Error_Debug, LOG_EVT_NOTICE_PLAY_FINISHED, CSimpleStringA::Format("notice %s play finished.", ret.VideoNames.GetData()).GetData());
+		//LogWarn(Severity_Low, Error_Debug, LOG_EVT_NOTICE_PLAY_FINISHED, CSimpleStringA::Format("notice %s play finished.", ret.VideoNames.GetData()).GetData());
 	}
 	else{
-		LogWarn(Severity_Low, Error_Debug, LOG_EVT_NOTICE_PLAY_EARLY_TERM, CSimpleStringA::Format("notice %s play early terminate.", entity->m_lastPlayVideo.c_str()).GetData());
+		//LogWarn(Severity_Low, Error_Debug, LOG_EVT_NOTICE_PLAY_EARLY_TERM, CSimpleStringA::Format("notice %s play early terminate.", entity->m_lastPlayVideo.c_str()).GetData());
 	}
 
 	entity->m_lastPlayVideo.clear();
@@ -1731,8 +1675,6 @@ void* StartAudioPlayingThreadFunc(void* param)
 
 	entity->m_uAudioPlayThreadId = 0;
 
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Exit Start Audio Playing Thread Function.");
-
 	return 0;
 }
 
@@ -2185,13 +2127,11 @@ void CLocalMediaPlayEntity::StopImage(int nCfgInx)
 		if (0 == m_iPlayType){
 			if (false == m_pImagePlayer[nCfgInx]->checkIsStop()) {
 				m_pImagePlayer[nCfgInx]->Close();
-				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopImage!");
 			}
 		} 
 		else{
 			if (false == m_pPicturePlayer[nCfgInx]->checkIsStop()) {
 				m_pPicturePlayer[nCfgInx]->Close();
-				//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopImage!");
 			}
 		}
 #else
@@ -2214,7 +2154,6 @@ void CLocalMediaPlayEntity::StopAll()
 
 bool CLocalMediaPlayEntity::GetLocalVideoVolume(int nCfgInx, int &nVolume)
 {
-	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get local video volume req.");
 	CSmartPointer<IConfigInfo> spConfig;
 	ErrorCodeEnum Error = GetFunction()->OpenConfig(Config_Run, spConfig);
 	if (Error == Error_Succeed)
@@ -2379,7 +2318,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartMediaPlayerNotice(int nCfgInx, int nWn
 				m_lastPlayVideo = pVideoName;
 
 				m_uNoticePlayThreadId = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&StartNoticePlayThreadFunc, this, 0, NULL);
-				LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play notice %s", strNoticeFileName.GetData()).GetData());
+				//LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play notice %s", strNoticeFileName.GetData()).GetData());
 			}
 			else{
 				Error = Error_InvalidState;
@@ -2402,9 +2341,7 @@ 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());
 	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);
 	int nCfgInx = entity->m_mediaParam.nCfgInx;
 	int nWndX = entity->m_mediaParam.nWndX;
 	int nWndY = entity->m_mediaParam.nWndY;
@@ -2431,8 +2368,6 @@ 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");
 
 	entity->m_uNoticePlayThreadId = NULL;
 
@@ -2478,7 +2413,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartFFPlayerNotice(int nCfgInx, int nWndX,
 #ifdef RVC_OS_WIN
 				m_uNoticePlayThreadId = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&StartNoticePlayThreadFunc, this, 0, NULL);
 				if (NULL != m_uNoticePlayThreadId) {
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play video notice %s", strNoticeFileName.GetData()).GetData());
+					//LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play video notice %s", strNoticeFileName.GetData()).GetData());
 				}
 				else {
 					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create notice play thread failed.");
@@ -2486,7 +2421,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartFFPlayerNotice(int nCfgInx, int nWndX,
 #else
 				int err = pthread_create(&m_uNoticePlayThreadId, NULL, StartNoticePlayThreadFunc, this);
 				if (0 == err) {
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play video notice %s", strNoticeFileName.GetData()).GetData());
+					//LogWarn(Severity_Low, Error_Debug, LOG_EVT_START_NOTICE_PLAY, CSimpleStringA::Format("start play video notice %s", strNoticeFileName.GetData()).GetData());
 				}
 				else {
 					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create notice play thread failed.");
@@ -2555,7 +2490,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::StopNotice(int nCfgInx)
 				
 			WaitForSingleObject(m_uNoticePlayThreadId, INFINITE);
 			if (m_lastPlayVideo.length() > 0) {
-				LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_NOTICE_PLAY, CSimpleStringA::Format("success to stop play notice ", m_lastPlayVideo.c_str()).GetData());
+				//LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_NOTICE_PLAY, CSimpleStringA::Format("success to stop play notice ", m_lastPlayVideo.c_str()).GetData());
 			}
 			m_uNoticePlayThreadId = NULL;
 		}
@@ -2565,7 +2500,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::StopNotice(int nCfgInx)
 		if (m_uNoticePlayThreadId > 0) {
 			if (0 == pthread_join(m_uNoticePlayThreadId, NULL)) {
 				if (m_lastPlayVideo.length() > 0) {
-					LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_NOTICE_PLAY, CSimpleStringA::Format("%s%s", "success to stop play notice ", m_lastPlayVideo.c_str()).GetData());
+					//LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_NOTICE_PLAY, CSimpleStringA::Format("%s%s", "success to stop play notice ", m_lastPlayVideo.c_str()).GetData());
 				}
 			}
 			m_uNoticePlayThreadId = 0;
@@ -2730,7 +2665,6 @@ 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());
 	Error = m_pEntity->StartNotice(ctx->Req.CfgInx, ctx->Req.WndX, ctx->Req.WndY, ctx->Req.WndWidth, ctx->Req.WndHeight, VideoName.GetData());
 	ctx->Answer(Error);
 }
@@ -2738,7 +2672,6 @@ 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);
 	ErrorCodeEnum Error = m_pEntity->StopNotice(ctx->Req.CfgInx);
 	ctx->Answer(Error);
 }
@@ -2747,7 +2680,6 @@ void CLocalMediaPlaySession::Handle_StopPlayNotice(SpReqAnsContext<PlayService_S
 void CLocalMediaPlaySession::Handle_StopPlayAllMedias(SpReqAnsContext<PlayService_StopPlayAllMedias_Req, PlayService_StopPlayAllMedias_Ans>::Pointer ctx)
 {
 	DbgToBeidou(ctx->link, __FUNCTION__)();
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop play all medias");
 	ErrorCodeEnum Error = m_pEntity->StopPlayAllMedias();
 	ctx->Answer(Error);
 }