Pārlūkot izejas kodu

Z991239-6176 #comment:录像库日志优化

80274480 5 mēneši atpakaļ
vecāks
revīzija
6d6c2e6f1d

+ 1 - 1
Module/mod_counterconnector/http_callrouter.cpp

@@ -93,7 +93,7 @@ node_list_head_t* get_http_callroute_list(http_call_info_t* pinfo, int itimeout,
 		req.terminalNo = pData;
 	}
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true":"false");
+	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true":"false");
 
 	CallRouteHTTPRet ret;
 	PROCESS_LINK_CONTEXT("LR0402304CallRoute")

+ 0 - 4
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -202,10 +202,6 @@ void CMediaControllerEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmar
 	}
 #endif
 
-	if (GetFunction()->RegistSysVarEvent("SessionID", this) != Error_Succeed){
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("register sysvar %s failed!", "SessionID");
-	}
-
 	if (GetFunction()->RegistSysVarEvent(SYSVAR_CALLSTATE, this) != Error_Succeed) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("register sysvar %s failed!", SYSVAR_CALLSTATE);
 	}

+ 26 - 30
Module/mod_recorder/mod_recorder.cpp

@@ -334,42 +334,38 @@ CServerSessionBase* CRecorderEntity::OnNewSession(const char* pszRemoteEntityNam
 
 void CRecorderEntity::Debug(record_loglevel elevel, const char *fmt, ...)
 {
-	if (RECORD_LOG_INFO <= elevel) {
-		va_list arg;
-		va_start(arg, fmt);
-
-		int n = vsnprintf(NULL, 0, fmt, arg);
-		if (n >= MAX_LOG_LEN) {
-			char* buf = (char*)malloc((size_t)(n + 1));
-			vsnprintf(buf, n + 1, fmt, arg);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
-			free(buf);
-		}
-		else{
-			char strlog[MAX_LOG_LEN] = {0};
-			vsnprintf(strlog, MAX_LOG_LEN, fmt, arg);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
-		}
-		va_end(arg);
+	va_list arg;
+	va_start(arg, fmt);
+
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_LOG_LEN) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink((LOG_LEVEL_E)elevel, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else{
+		char strlog[MAX_LOG_LEN] = {0};
+		vsnprintf(strlog, MAX_LOG_LEN, fmt, arg);
+		DbgWithLink((LOG_LEVEL_E)elevel, LOG_TYPE_SYSTEM)("%s", strlog);
 	}
+	va_end(arg);
 }
 
 
 void CRecorderEntity::vDebug(record_loglevel elevel, const char* str, va_list list)
 {
-	if (RECORD_LOG_INFO <= elevel) {
-		int n = vsnprintf(NULL, 0, str, list);
-		if (n >= MAX_LOG_LEN) {
-			char* buf = (char*)malloc((size_t)(n + 1));
-			vsnprintf(buf, n + 1, str, list);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
-			free(buf);
-		}
-		else {
-			char strlog[MAX_LOG_LEN] = { 0 };
-			vsnprintf(strlog, MAX_LOG_LEN, str, list);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
-		}
+	int n = vsnprintf(NULL, 0, str, list);
+	if (n >= MAX_LOG_LEN) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, str, list);
+		DbgWithLink((LOG_LEVEL_E)elevel, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_LOG_LEN] = { 0 };
+		vsnprintf(strlog, MAX_LOG_LEN, str, list);
+		DbgWithLink((LOG_LEVEL_E)elevel, LOG_TYPE_SYSTEM)("%s", strlog);
 	}
 }
 

+ 1 - 1
Module/mod_recorder/recordinfo.cpp

@@ -66,7 +66,7 @@ int post_video_recordinfo_list(unsigned int& uposttime, CSimpleStringA& errormsg
 
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_reqContent is %s.", req.m_reqContent.c_str());
 
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true" : "false");
+	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin http get request, timeout is %d, printdbg flag is %s.", req.m_timeOut, req.m_printDbg ? "true" : "false");
 
 	unsigned int ustarttime = SP::Module::Comm::RVCGetTickCount();
 

+ 9 - 9
Other/libvideorecord/FFmpegWriter.cpp

@@ -125,7 +125,7 @@ static bool add_stream(LogApi* pLogApi, OutputStream *ost, AVFormatContext *oc,
             enc_ctx->sample_rate = nSamplePsec;
             if ((*codec)->supported_samplerates) {
                 for (int i = 0; (*codec)->supported_samplerates[i]; i++) {
-				    pLogApi->Debug("(*codec)->supported_samplerates[%d] = %d.", i, (*codec)->supported_samplerates[i]);
+				    //pLogApi->Debug("(*codec)->supported_samplerates[%d] = %d.", i, (*codec)->supported_samplerates[i]);
                 }
             }
 		    if (nchannels == 2){
@@ -197,7 +197,7 @@ static bool add_stream(LogApi* pLogApi, OutputStream *ost, AVFormatContext *oc,
         enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
     }
 
-    pLogApi->Debug("add_stream success get encoder for '%s'", avcodec_get_name(codec_id));
+    //pLogApi->Debug("add_stream success get encoder for '%s'", avcodec_get_name(codec_id));
 
 	return true;
 }
@@ -292,7 +292,7 @@ static bool open_audio(LogApi* pLogApi, AVFormatContext *oc, AVCodec *codec, Out
         return false;
     }
 
-    pLogApi->Debug("open_audio success encoder for %s, nb_samples:%d.", avcodec_get_name(codec->id), nb_samples);
+    //pLogApi->Debug("open_audio success encoder for %s, nb_samples:%d.", avcodec_get_name(codec->id), nb_samples);
 
 	return true;
 }
@@ -478,11 +478,11 @@ static bool open_video(LogApi* pLogApi, AVFormatContext *oc, AVCodec *codec, Out
         return false;
     }
 
-    pLogApi->Debug("open_video success encoder for %s.", avcodec_get_name(codec->id));
-    pLogApi->Debug("open_video success encoder output_fmt: %s.", av_get_pix_fmt_name(enc_ctx->pix_fmt));
-    pLogApi->Debug("open_video success encoder input_fmt: %s.", av_get_pix_fmt_name(input_pix_fmt));
-    pLogApi->Debug("open_video success encoder, video enc_ctx time_base num: %d.", enc_ctx->time_base.num);
-    pLogApi->Debug("open_video success encoder, video enc_ctx time_base den: %d.", enc_ctx->time_base.den);
+    //pLogApi->Debug("open_video success encoder for %s.", avcodec_get_name(codec->id));
+    //pLogApi->Debug("open_video success encoder output_fmt: %s.", av_get_pix_fmt_name(enc_ctx->pix_fmt));
+    //pLogApi->Debug("open_video success encoder input_fmt: %s.", av_get_pix_fmt_name(input_pix_fmt));
+    //pLogApi->Debug("open_video success encoder, video enc_ctx time_base num: %d.", enc_ctx->time_base.num);
+    //pLogApi->Debug("open_video success encoder, video enc_ctx time_base den: %d.", enc_ctx->time_base.den);
 
 	return true;
 }
@@ -658,7 +658,7 @@ bool FFmpegWriter::InitWriter(char* filename, int width, int height, int colorbi
     //av_log_set_level(AV_LOG_ERROR);
     //av_log_set_callback(log_callback);
     m_outfmt = m_formatctx->oformat;
-	m_pLogApi->Debug("real output format name of '%s' is %s, long_name is %s, mime_type is %s, extensions is %s.", filename, m_outfmt->name, m_outfmt->long_name, m_outfmt->mime_type, m_outfmt->extensions);
+	//m_pLogApi->Debug("real output format name of '%s' is %s, long_name is %s, mime_type is %s, extensions is %s.", filename, m_outfmt->name, m_outfmt->long_name, m_outfmt->mime_type, m_outfmt->extensions);
 
     m_video_st = new OutputStream();
     m_audio_st = new OutputStream();

+ 3 - 2
Other/libvideorecord/libvideorecord.h

@@ -45,10 +45,11 @@ enum eStereoArrayType{
 };
 
 enum record_loglevel {
-	RECORD_LOG_NO,
 	RECORD_LOG_DEBUG,
 	RECORD_LOG_INFO,
-	RECORD_LOG_ERROR
+	RECORD_LOG_WARN,
+	RECORD_LOG_ERROR,
+	RECORD_LOG_FATAL
 };
 
 enum eAudioOutPutType{

+ 16 - 19
Other/libvideorecord/libvideorecord_impl.cpp

@@ -824,9 +824,9 @@ bool libvideorecord_impl::GetRecordVideoFrameSize()
 		}
 	}
 
-	if (bRet) {
-		m_pHostApi->Debug(RECORD_LOG_DEBUG, "get video framesize is %d, and width is %d, height is %d.", m_iVideoFrameSize, m_iWidth, m_iHeight);
-	}
+	//if (bRet) {
+	//	m_pHostApi->Debug(RECORD_LOG_DEBUG, "get video framesize is %d, and width is %d, height is %d.", m_iVideoFrameSize, m_iWidth, m_iHeight);
+	//}
 		
 	return bRet;
 }
@@ -856,9 +856,9 @@ bool libvideorecord_impl::GetRecordAudioFrameSize()
 		}
 	}
 
-	if (bRet) {
-		m_pHostApi->Debug(RECORD_LOG_DEBUG, "local audio frame size = %d.", m_iAudioFrameSize);
-	}
+	//if (bRet) {
+	//	m_pHostApi->Debug(RECORD_LOG_DEBUG, "local audio frame size = %d.", m_iAudioFrameSize);
+	//}
 
 	return bRet;
 }
@@ -889,9 +889,9 @@ bool libvideorecord_impl::GetRecordAudioParams(audio_frame** paudio)
 
 	RECORD_SAFE_DELETE((*paudio)->data);
 
-	if (bRet) {
-		m_pHostApi->Debug(RECORD_LOG_DEBUG, "audio samplespersec=%d,framesize=%d,channels=%d,format=%d,bitspersample=%d,series number=%d.", (*paudio)->samplespersec, (*paudio)->framesize, (*paudio)->nchannels, (*paudio)->format, (*paudio)->bitspersample, (*paudio)->iseriesnumber);
-	}
+	//if (bRet) {
+	//	m_pHostApi->Debug(RECORD_LOG_DEBUG, "audio samplespersec=%d,framesize=%d,channels=%d,format=%d,bitspersample=%d,series number=%d.", (*paudio)->samplespersec, (*paudio)->framesize, (*paudio)->nchannels, (*paudio)->format, (*paudio)->bitspersample, (*paudio)->iseriesnumber);
+	//}
 
 	return bRet;
 }
@@ -919,13 +919,12 @@ bool libvideorecord_impl::CalcuRecordAudioParams(audio_frame* paudio)
 	//计算每秒音频的长度
 	m_iAudioPerSecBufLen = paudio->samplespersec * paudio->bitspersample / 8;
 	m_iRecordAudioBufSize = m_iAudioPerSecBufLen;
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "m_iAudioPerSecBufLen=%d", m_iAudioPerSecBufLen);
+	//m_pHostApi->Debug(RECORD_LOG_DEBUG, "m_iAudioPerSecBufLen=%d", m_iAudioPerSecBufLen);
 	//计算音频帧的帧频,
 	m_iLocalAudioFps = m_iAudioPerSecBufLen / paudio->framesize;
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "音频帧的帧频 m_iLocalAudioFps=%d", m_iLocalAudioFps);
+	//m_pHostApi->Debug(RECORD_LOG_DEBUG, "音频帧的帧频 m_iLocalAudioFps=%d", m_iLocalAudioFps);
 	if (eSingleSide != m_eRecordType) {
 		if (eStand2Agent == m_eRecordType) {  //可视柜台渠道的双向录像,本地端和坐席端声音采用左右声道方式录制
-		
 			m_iRemoteAudioFps = 50;
 			m_iRecordAudioBufSize = m_iAudioPerSecBufLen * 2;
 		}
@@ -940,7 +939,7 @@ bool libvideorecord_impl::CalcuRecordAudioParams(audio_frame* paudio)
 		}
 	}
 
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "audio fps = %d, record audio buffer size = %d.", m_iLocalAudioFps, m_iRecordAudioBufSize);
+	//m_pHostApi->Debug(RECORD_LOG_DEBUG, "audio fps = %d, record audio buffer size = %d.", m_iLocalAudioFps, m_iRecordAudioBufSize);
 
 	bRet = true;
 
@@ -1365,7 +1364,6 @@ bool libvideorecord_impl::InitCvxText()
 
 	string fontfile = "";
 
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "FindMatchedFile");
 #ifdef _WIN32
 	if (FindMatchedFile(TtcDir.c_str(), "msyh.", fontfile))
 #else
@@ -2110,9 +2108,9 @@ bool libvideorecord_impl::GetLocalAudioFrame(int iAudioLens)
 		if (CAPTURE_CLOCK == m_audioframe->samplespersec) {
 			m_iAudioBufferLen += m_audioframe->framesize;
 			m_iAudioFromQueNum++;
-			if ((0 == m_iAudioFromQueNum % 100) && 0 != m_audioframe->iseriesnumber) {
-				m_pHostApi->Debug(RECORD_LOG_DEBUG, "current audio queue len is %d and audio series number is: %d.", iAudioLens, m_audioframe->iseriesnumber);
-			}
+			//if ((0 == m_iAudioFromQueNum % 100) && 0 != m_audioframe->iseriesnumber) {
+			//	m_pHostApi->Debug(RECORD_LOG_DEBUG, "current audio queue len is %d and audio series number is: %d.", iAudioLens, m_audioframe->iseriesnumber);
+			//}
 			bRet = true;
 		}
 		else {
@@ -2244,7 +2242,6 @@ bool libvideorecord_impl::GetRecordAudioFrame()
 			m_iAudioBufferLen = uOutlen;
 		}
 	}
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "current m_iAudioBufferLen = %d, m_iAudioPerSecBufLen = %d.", m_iAudioBufferLen, m_iAudioPerSecBufLen);
 
 	return bRet;
 }
@@ -2331,7 +2328,7 @@ bool libvideorecord_impl::InitVideoRecordParams()
 			m_pHostApi->Debug(RECORD_LOG_INFO, "Ns audio set params failed, set AudioNsOn false.");
 		}
 	}
-	m_pHostApi->Debug(RECORD_LOG_DEBUG, "InitRecordWriter samplespersec=%d,audioOutChannels=%d,audioOutBitRate=%d bps.", audio->samplespersec, m_iAudioChannels, uOutPutBitRate);
+	//m_pHostApi->Debug(RECORD_LOG_DEBUG, "InitRecordWriter samplespersec=%d,audioOutChannels=%d,audioOutBitRate=%d bps.", audio->samplespersec, m_iAudioChannels, uOutPutBitRate);
 
 	if (!InitRecordWriter(m_VideoFileName, m_iWidth, m_iHeight, 24, m_nFps, audio->samplespersec,
 		m_iAudioChannels, audio->bitspersample, 6, m_videoquality, uOutPutBitRate, (int)m_eAudioType)) {