Parcourir la source

Z991239-6004 #comment 优化媒体播放库日志

80274480 il y a 7 mois
Parent
commit
974a220174

+ 12 - 6
Module/mod_localmediaplay/AdvertManage/MediaManage.cpp

@@ -220,14 +220,14 @@ void mediaManage::InitResourceListByLocal()
 	vector<ResourceParse> headList, branchList, networkList, allList;
 
 	if (!checkFileExist(headFile)) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("head config %s not exist!", headFile.c_str());
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("head config %s not exist!", headFile.c_str());
 	}
 	else if (!parseResourceIni(headFile.c_str(), headList)) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse head config %s fail!", headFile.c_str());
 	}
 
 	if (!checkFileExist(branchFile)) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("branch config %s not exist!", branchFile.c_str());
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("branch config %s not exist!", branchFile.c_str());
 	}
 	else if (!parseResourceIni(branchFile.c_str(), branchList)) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse branch config %s fail!", branchFile.c_str());
@@ -235,7 +235,7 @@ void mediaManage::InitResourceListByLocal()
 
 
 	if (!checkFileExist(networkFile)) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("network config %s not exist!", networkFile.c_str());
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("network config %s not exist!", networkFile.c_str());
 	}
 	else if (!parseResourceIni(networkFile.c_str(), networkList)) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse network config %s fail!", networkFile.c_str());
@@ -292,22 +292,23 @@ void mediaManage::InitResourceListByLocal()
 		});
 
 	CSimpleStringA strJson("");
+	CSimpleStringA strValidTimeJson("");
 	int index = 0;
 	for (auto i = m_localList.begin(); i != m_localList.end(); i++)
 	{
 		size_t pos = i->videoNames.find("\\");
 		if (pos != string::npos){
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s find result is not string::npos", i->videoNames.c_str());
 			i->resourcePath = m_addvertPath + SPLIT_SLASH_STR + i->videoNames.substr(0, pos) + SPLIT_SLASH_STR;
 			i->videoNames = i->videoNames.substr(pos + 1, i->videoNames.length() - pos - 1);
 		}
 		else {
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s find result is string::npos", i->videoNames.c_str());
 			i->resourcePath = m_addvertPath + SPLIT_SLASH_STR;
 		}
 
 		if (blog) {
-			strJson += CSimpleStringA::Format("\"%d\":\"%s\",", index++, i->videoNames.c_str());
+			strJson += CSimpleStringA::Format("\"%d\":\"%s\",", index, i->videoNames.c_str());
+			strValidTimeJson += CSimpleStringA::Format("\"%d\":\"%s\",", index, i->vaildTime.c_str());
+			index++;
 		}
 	}
 
@@ -316,6 +317,11 @@ void mediaManage::InitResourceListByLocal()
 			strJson[strJson.GetLength() - 1] = '\0';
 		}
 		LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_PLAYLIST_INFO, CSimpleStringA::Format("[{%s}]", strJson.GetData()).GetData());
+		
+		if (strValidTimeJson.GetLength() > 0) {
+			strValidTimeJson[strValidTimeJson.GetLength() - 1] = '\0';
+		}
+		LogWarn(Severity_Low, Error_Debug, LOG_EVT_ADV_PLAYLIST_VALIDTIME, CSimpleStringA::Format("[{%s}]", strValidTimeJson.GetData()).GetData());
 	}
 }
 

+ 2 - 1
Module/mod_localmediaplay/Event.h

@@ -16,4 +16,5 @@
 #define LOG_EVT_NOTICE_FILE_NOT_VALID		0x3130010C
 #define LOG_EVT_MEDIAPLAY_COST_TIME_ERROR	0x3130010D
 #define LOG_EVT_ADV_PLAYLIST_INFO			0x3130010E
-#define LOG_EVT_NOTSUPPORT_AUDIOFORMAT		0x3130010F
+#define LOG_EVT_NOTSUPPORT_AUDIOFORMAT		0x3130010F
+#define LOG_EVT_ADV_PLAYLIST_VALIDTIME		0x31300110

+ 7 - 59
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -789,10 +789,7 @@ 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_DEBUG, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
-		}
-		else {
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("user stop, not broadcast!");
+			//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SpSendBroadcast AudioPlayRet and audio name is %s.", ret.AudioNames.GetData());
 		}
 	}
 	else {
@@ -832,7 +829,10 @@ int CLocalMediaPlayEntity::PlayingAudioDataCallback(audio_param_t* param, const
 	if (0 != m_iPlayType && m_bStartRecord) {
 		if (false == m_bloged) {
 			m_bloged = true;
-			LogWarn(Severity_Low, Error_Debug, LOG_EVT_PLAYING_AUDIO_INFOS, CSimpleStringA::Format("audio param target (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d), audio format(%d)).", param->channels, param->freq, param->channel_layout, param->frame_size, param->bytes_per_sec, param->fmt).GetData());
+			if (8000 != param->freq || 1 != param->channels) {
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_PLAYING_AUDIO_INFOS, CSimpleStringA::Format("audio param target (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d), audio format(%d)).", param->channels, param->freq, param->channel_layout, param->frame_size, param->bytes_per_sec, param->fmt).GetData());
+			}
+			
 			if (!IsSupportAudioSamprate(param->freq)) {
 				LogWarn(Severity_Middle, Error_Debug, LOG_EVT_NOTSUPPORT_AUDIOFORMAT, CSimpleStringA::Format("not support audio param (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d), audio format(%d)).", param->channels, param->freq, param->channel_layout, param->frame_size, param->bytes_per_sec, param->fmt).GetData());
 			}
@@ -1234,9 +1234,7 @@ ErrorCodeEnum CLocalMediaPlayEntity::HandleRemoteRecord(const char* pszMessage)
 DWORD WINAPI StartAudioPlayingThreadFunc(LPVOID param)
 {
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Enter StartAudioPlayingThreadFunc");
 	const char* pAudioNames = entity->m_lastPlayAudio.c_str();
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin StartAudio, and Audio Info is %s.", pAudioNames);
 	if (0 == entity->m_iPlayType) {
 		HANDLE playEndEvent = NULL;
 		entity->m_pAudioPlayer->PlayLocalAudio(pAudioNames);
@@ -1268,7 +1266,6 @@ DWORD WINAPI StartAudioPlayingThreadFunc(LPVOID param)
 DWORD WINAPI NoticePlayThread(LPVOID param)
 {
 	CLocalMediaPlayEntity *entity = (CLocalMediaPlayEntity*)param;
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin NoticePlayThread");
 
 	HANDLE playEndEvent = NULL;
 	if (!entity->m_pVideoPlayer[entity->m_mediaParam.nCfgInx]->checkIsPlay(playEndEvent)){
@@ -1305,8 +1302,6 @@ DWORD WINAPI NoticePlayThread(LPVOID param)
 
 	entity->m_lastPlayVideo.clear();
 
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("End NoticePlayThread");
-
 	return 0;
 }
 
@@ -1317,8 +1312,6 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 
 	static bool blog = true;
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter Windows Media Play Thread.");
-
 	while (entity->GetPlayFlag())
 	{
 		vector<ResourceParse> curParse;
@@ -1394,7 +1387,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);
+
 					config.nWndX = entity->m_mediaParam.nWndX;
 					config.nWndY = entity->m_mediaParam.nWndY;
 					config.nWndWidth = entity->m_mediaParam.nWndWidth;
@@ -1416,9 +1409,6 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						continue;
 					}
 
-					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!");
@@ -1453,9 +1443,6 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 						continue;
 					}
 
-					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!");
@@ -1489,8 +1476,6 @@ DWORD WINAPI MediaPlayThread(LPVOID param)
 	if (entity->m_playThread) {
 		entity->m_playThread = NULL;
 	}
-	
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Exit Windows Media Play Thread.");
 
 	return 0;
 }
@@ -1502,7 +1487,6 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 	if (NULL == param){
 		return iRet;
 	}
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter FFmpeg Media Play Function.");
 
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
 	static bool blog = true;
@@ -1589,10 +1573,6 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				if (!CheckFileExist(config.strRootPath, config.strFileNames[0], blog)) {
 					continue;
 				}
-
-				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) {
@@ -1624,9 +1604,6 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 				}
 
 				if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()){
-					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!");
@@ -1636,7 +1613,7 @@ DWORD WINAPI StartMediaPlayFunc(LPVOID param)
 
 					WaitForSingleObject(playThreadId, INFINITE);
 					if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()){//停止播放
-						//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop play video");
+						
 					}
 					else{
 						entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->Close();
@@ -1645,14 +1622,12 @@ 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秒");
 			break;
 		}
 		blog = false;
 	}
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Leave Media Play Function.");
 
 	if (entity->m_badplayflag) {
 		entity->m_badplayflag = false;
@@ -1685,8 +1660,6 @@ void* StartMediaPlayFunc(void* param)
 		return (void*)&iRet;
 	}
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter FFmpeg Media Play Function.");
-
 	CLocalMediaPlayEntity* entity = (CLocalMediaPlayEntity*)param;
 	static bool blog = true;
 	while (entity->GetPlayFlag())
@@ -1781,9 +1754,6 @@ void* StartMediaPlayFunc(void* param)
 					continue;
 				}
 
-				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;
@@ -1818,9 +1788,6 @@ void* StartMediaPlayFunc(void* param)
 				}
 
 				if (entity->m_pPicturePlayer[entity->m_mediaParam.nCfgInx]->checkIsStop()) {
-					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!");
@@ -1848,8 +1815,6 @@ void* StartMediaPlayFunc(void* param)
 	}
 
 	entity->m_uMediaPlayThreadId = 0;
-	
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Leave FFmpeg Media Play Function.");
 
 	return (void*)&iRet;
 }
@@ -1914,7 +1879,6 @@ 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_DEBUG, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
 				StopVideo(nCfgInx);
 			}
 
@@ -1926,7 +1890,6 @@ void CLocalMediaPlayEntity::StartVideo(int nCfgInx, int nWndX, int nWndY, int nW
 		}
 		else {
 			if (NULL != m_uMediaPlayThreadId) {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Current is playing video, close it.");
 				StopVideo(nCfgInx);
 			}
 			m_hStopMediaPlayEvent = CreateEventA(NULL, false, false, NULL);
@@ -1975,7 +1938,6 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 #ifdef RVC_OS_WIN
 	if (0 == m_iPlayType) {
 		if (!m_pAudioPlayer->checkIsStop()) {
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current is playing, close it.");
 			StopAudio();
 		}
 		m_lastPlayAudio = pAudioNames;
@@ -1987,7 +1949,6 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 	else
 	{
 		if (m_pMediaAudioPlayer->checkIsPlay()) {
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current is playing, close it.");
 			StopAudio();
 		}
 		m_lastPlayAudio = pAudioNames;
@@ -1995,16 +1956,11 @@ void CLocalMediaPlayEntity::StartAudio(const char *pAudioNames)
 		m_buserstopaudio = false;
 		auto audioRet = GetLocalAudioVolume();
 		m_pMediaAudioPlayer->SetVolume(audioRet.second);
-		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Succeed to set audio volume %d!", audioRet.second);
 	}
 #else
 	if (m_pMediaAudioPlayer->checkIsPlay()) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current is playing, close it.");
 		StopAudio();
 	}
-	else {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current is not playing, start paly audio %s.", pAudioNames);
-	}
 
 	m_lastPlayAudio = pAudioNames;
 
@@ -2061,7 +2017,6 @@ 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!");
 				CloseHandle(m_hStopMediaPlayEvent);
 			}
 		} 
@@ -2072,7 +2027,6 @@ 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!");
 				CloseHandle(m_hStopMediaPlayEvent);
 			}
 		}
@@ -2103,7 +2057,6 @@ void CLocalMediaPlayEntity::StopAudio()
 		m_buserstopaudio = true;
 		WaitForSingleObject(m_uAudioPlayThreadId, INFINITE);
 		m_uAudioPlayThreadId = NULL;
-		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Succeed to StopAudio!");
 	}
 #else
 	if (0 != m_uAudioPlayThreadId) {
@@ -2289,12 +2242,10 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartMediaPlayerNotice(int nCfgInx, int nWn
 {
 #ifdef RVC_OS_WIN
 	if (false == m_pAudioPlayer->checkIsStop()) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
 		StopAudio();
 	}
 
 	if (false == m_pVideoPlayer[nCfgInx]->checkIsStop()) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
 		StopNotice(nCfgInx);
 	}
 #endif // RVC_OS_WI
@@ -2382,12 +2333,10 @@ ErrorCodeEnum CLocalMediaPlayEntity::StartFFPlayerNotice(int nCfgInx, int nWndX,
 	ErrorCodeEnum Error = Error_Succeed;
 
 	if (m_pMediaAudioPlayer->checkIsPlay()) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("audio current is playing, close it.");
 		StopAudio();
 	}
 
 	if (m_pMediaPlayer[nCfgInx]->checkIsPlay()) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("notice current is playing, close it.");
 		StopNotice(nCfgInx);
 	}
 
@@ -2554,7 +2503,6 @@ 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());
 
 	CSimpleStringA UpdateState = "";
 	ErrorCodeEnum Error = m_pEntity->GetFunction()->GetSysVar("UpdateState", UpdateState);

+ 3 - 57
Other/libmediaplayer/audio.cpp

@@ -59,7 +59,6 @@ static int audio_decode_frame(AVCodecContext *p_codec_ctx, packet_queue_t *p_pkt
         // 1. 取出一个packet。使用pkt对应的serial赋值给d->pkt_serial
         if (packet_queue_get(p_pkt_queue, &pkt, true, hostapi) < 0)
         {
-			hostapi->Debug(MEDIA_LOG_DEBUG, "packet_queue_get return -1 exit audio_decode_frame function.");
             return -1;
         }
 
@@ -116,7 +115,6 @@ static int audio_decode_thread(void *arg)
 				continue;
 			}
 			else {
-				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, " audio_decode_frame < 0, goto end");
 				goto the_end;
 			}
 		}
@@ -127,7 +125,6 @@ static int audio_decode_thread(void *arg)
 			tb.den = p_frame->sample_rate;
 			//从frame队列找到一个可写的空间,若未停止则一直等待,已停止时返回NULL
 			if (!(af = frame_queue_peek_writable(&is->audio_frm_queue))) {
-				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "frame_queue_peek_writable return NULL, goto end.");
 				goto the_end;
 			}
             af->pts = (p_frame->pts == AV_NOPTS_VALUE) ? NAN : p_frame->pts * av_q2d(tb);
@@ -196,7 +193,6 @@ int open_audio_stream(player_stat_t *is)
 
 		p_codec_ctx->pkt_timebase = is->m_paudio_stream[index]->time_base;
 		is->m_pacodec_ctx[index] = p_codec_ctx;
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d is->p_acodec_ctx[%d] = 0x%08x", __FUNCTION__, __LINE__, index, p_codec_ctx);
 	}
 
     // 2. 创建音频解码线程
@@ -230,7 +226,6 @@ static int audio_resample(player_stat_t *is, int64_t audio_callback_time)
 
     // 若队列头部可读,则由af指向可读帧
 	if (!(af = frame_queue_peek_readable(&is->audio_frm_queue))) {
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d user stop flag is %s, function return", __FUNCTION__, __LINE__, is->buser_stop ? "true" : "false");
 		return -1;
 	}
     frame_queue_next(&is->audio_frm_queue);
@@ -331,12 +326,6 @@ static int audio_resample(player_stat_t *is, int64_t audio_callback_time)
 #ifdef DEBUG
     {
         static double last_clock;
-        //printf("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n",
-        //    is->audio_clock - last_clock,
-        //    is->audio_clock, audio_clock0);
-		//is->rvc_log("audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n",
-		//	is->audio_clock - last_clock,
-		//	is->audio_clock, audio_clock0);
         last_clock = is->audio_clock;
     }
 #endif
@@ -385,66 +374,32 @@ static int open_audio_playing(void *arg)
     wanted_spec.userdata = is;                          // 提供给回调函数的参数
 	
 	if (NULL == is->m_straudiodev) {
-        static bool blog = true;
 		int iaudioapeaker = SDL_GetNumAudioDevices(0);
-        if (blog) {
-            is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "audio output device count is %d.", iaudioapeaker);
-        }
-		
 		int i = 0;
 		for (; i < iaudioapeaker; i++) {
 		#ifdef _WIN32
 			char* strdevice = Utf8ToGB2312(SDL_GetAudioDeviceName(i, 0));
-            if (blog) {
-                is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "device id %d audio device name is %s.", i, strdevice);
-            }
 			if (is->m_paudiodev && strstr(strdevice, is->m_paudiodev)) {
 				const char* strdevname = SDL_GetAudioDeviceName(i, 0);
 				is->m_straudiodev = av_strdup(strdevname);
-                if (blog) {
-                    is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "%s matched audio device name is %s.", is->m_paudiodev, strdevice);
-                }
 				delete []strdevice;
 				break;
 			}
             else {
                 delete[] strdevice;
 #else
-            if (blog) {
-                is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "device id %d audio device name is %s.", i, SDL_GetAudioDeviceName(i, 0));
-            }
             if (is->m_paudiodev && strstr(SDL_GetAudioDeviceName(i, 0), is->m_paudiodev)) {
                 const char* strdevname = SDL_GetAudioDeviceName(i, 0);
                 is->m_straudiodev = av_strdup(strdevname);
-                if (blog) {
-                    is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "%s matched audio device name is %s.", is->m_paudiodev, strdevname);
-                }
                 break;
 			#endif
 			}
 		}
+
 		if (i == iaudioapeaker) {
 			is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "matched audio device name (%s) failed!", is->m_straudiodev ? is->m_straudiodev : "null");
             return -1;
         }
-
-		{
-			int inum = SDL_GetNumAudioDrivers();
-			int i = 0;
-            if (blog) {
-                is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "Audio Drivers number is %d.", inum);
-            }
-			for (; i < inum; i++) {
-				const char* drivername = SDL_GetAudioDriver(i);
-                if (blog) {
-                    is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "[%d] Audio Drivers name is %s.", i, drivername);
-                }
-			}
-		}
-        if (blog) {
-            is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "current audio driver name is %s.", SDL_GetCurrentAudioDriver());
-        }
-        blog = false;
 	}
 
 	while (!(is->m_audio_dev = SDL_OpenAudioDevice(is->m_straudiodev, 0, &wanted_spec, &actual_spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))){
@@ -458,15 +413,12 @@ static int open_audio_playing(void *arg)
 		return -1;
 	}
 
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_OpenAudioDevice success and audio_dev is %d.", is->m_audio_dev);
     is->m_audio_param_tgt.fmt = AV_SAMPLE_FMT_S16;
     is->m_audio_param_tgt.freq = actual_spec.freq;
     is->m_audio_param_tgt.channel_layout = av_get_default_channel_layout(actual_spec.channels);
     is->m_audio_param_tgt.channels = actual_spec.channels;
     is->m_audio_param_tgt.frame_size = av_samples_get_buffer_size(NULL, actual_spec.channels, 1, (AVSampleFormat)is->m_audio_param_tgt.fmt, 1);
     is->m_audio_param_tgt.bytes_per_sec = av_samples_get_buffer_size(NULL, actual_spec.channels, actual_spec.freq, (AVSampleFormat)is->m_audio_param_tgt.fmt, 1);
-	
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "audio param target (%d channels, %d Hz, channel_layout(%d), frame_size(%d), bytes_per_sec(%d)).", actual_spec.channels, actual_spec.freq, is->m_audio_param_tgt.channel_layout, is->m_audio_param_tgt.frame_size, is->m_audio_param_tgt.bytes_per_sec);
 
 	if (is->m_audio_param_tgt.bytes_per_sec <= 0 || is->m_audio_param_tgt.frame_size <= 0){
 		is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "av_samples_get_buffer_size failed.");
@@ -478,10 +430,8 @@ static int open_audio_playing(void *arg)
     is->audio_frm_size = 0;
     is->audio_cp_index = 0;
 
-
 	SDL_PauseAudioDevice(is->m_audio_dev, 0);
 
-
 	return 0;
 }
 
@@ -506,9 +456,9 @@ static void sdl_audio_callback(void *opaque, uint8_t*stream, int len)
 			if (audio_size < 0){
 				if (-1 == audio_size) {
 					if (is->m_baudio_decode_finished) {
-						is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "audio_size is -1 sdl_audio_callback return, and set abort flag to true.");
+						//is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "audio_size is -1 sdl_audio_callback return, and set abort flag to true.");
 						is->on_audio_play_finished(is->user_data);
-                        is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_SemPost m_audio_play_wait_sem.");
+                        //is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_SemPost m_audio_play_wait_sem.");
                         SDL_SemPost(is->m_audio_play_wait_sem);
 						return;
 					}
@@ -570,13 +520,11 @@ static void sdl_audio_callback(void *opaque, uint8_t*stream, int len)
 int open_audio(player_stat_t *is)
 {
     int iret = -1;
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "enter open_audio()");
 	if (-1 == is->audio_idx[is->m_icurrent_index]){
 		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "not find audio stream");
 	}
 	else {
         if (0 == open_audio_stream(is)) {
-            is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "open audio stream success");
             iret = open_audio_playing(is);
             if (0 != iret) {
                 is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "open audio playing failed");
@@ -587,7 +535,5 @@ int open_audio(player_stat_t *is)
         }
 	}
 
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "exit open_audio()");
-
     return iret;
 }

+ 0 - 12
Other/libmediaplayer/demux.cpp

@@ -44,7 +44,6 @@ static int demux_init(player_stat_t *is)
 			break;
 		}
 		is->m_pfmt_ctx[index] = p_fmt_ctx;
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "is->p_fmt_ctx[%d] = 0x%08x, p_fmt_ctx = 0x%08x", index, is->m_pfmt_ctx[index], p_fmt_ctx);
 
 		// 1.2 搜索流信息:读取一段视频文件数据,尝试解码,将取到的流信息填入p_fmt_ctx->streams
 		//     ic->streams是一个指针数组,数组大小是pFormatCtx->nb_streams
@@ -63,11 +62,9 @@ static int demux_init(player_stat_t *is)
 		for (int i = 0; i < (int)p_fmt_ctx->nb_streams; i++){
 			if ((p_fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) && (a_idx == -1)){
 				a_idx = i;
-				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s Find a audio stream, index %d, media type is %s.", is->m_strPlayLists[index], a_idx, Media_Type_Table[is->m_eMType]);
 			}
 			if ((p_fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && (v_idx == -1)){
 				v_idx = i;
-				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s Find a video stream, index %d, media type is %s.", is->m_strPlayLists[index], v_idx, Media_Type_Table[is->m_eMType]);
 			}
 			if (a_idx != -1 && v_idx != -1){
 				break;
@@ -117,10 +114,8 @@ static int demux_thread(void *arg)
     int ret = 0;
     
 	AVPacket pkt1, *pkt = &pkt1;
-
     SDL_mutex *wait_mutex = SDL_CreateMutex();
 
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "begin %s av_read_frame, nFilecount is %d, current index is %d.", is->m_strPlayLists[is->m_icurrent_index], is->m_uFilesCount, is->m_icurrent_index);
     // 4. 解复用处理
 	while (false == is->buser_stop)
     {
@@ -153,10 +148,8 @@ static int demux_thread(void *arg)
 				if (is->m_icurrent_index + 1 < is->m_uFilesCount){
 					is->m_icurrent_index++;
 					ret = 0;
-					is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "begin %s av_read_frame, nFilecount is %d, current is->index is %d.", is->m_strPlayLists[is->m_icurrent_index], is->m_uFilesCount, is->m_icurrent_index);
 				}
 				else {
-					is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "av_read_frame ret is AVERROR_EOF.");
 					break;
 				}
             }
@@ -181,8 +174,6 @@ static int demux_thread(void *arg)
 
     SDL_DestroyMutex(wait_mutex);
 
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s exit, thread id is %u, buser_stop flag is %s.",SDL_GetThreadName(is->m_read_tid), SDL_ThreadID(), is->buser_stop ? "true" : "false");
-
     return 0;
 }
 
@@ -199,9 +190,6 @@ int open_demux(player_stat_t *is)
 		is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "SDL_CreateThread() failed: %s.", SDL_GetError());
         return -1;
     }
-	else {
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "create %s success, and thread id is %u.", SDL_GetThreadName(is->m_read_tid), SDL_GetThreadID(is->m_read_tid));
-	}
 
     return 0;
 }

+ 0 - 12
Other/libmediaplayer/libmediaplayer.cpp

@@ -195,8 +195,6 @@ int libmediaplayer_impl::GetLocalAudioPlayingParams(rvc_media_player_param_t* pP
 	}
 	m_stPlayConfig.bPrimMonitor = true;
 	m_stPlayConfig.nFileCnt = FileCount;
-	m_pHostApi->Debug(MEDIA_LOG_DEBUG, "AudioNames = %s!", pAudioNames);
-	m_pHostApi->Debug(MEDIA_LOG_DEBUG, "Audio config.nFileCnt = %d!", FileCount);
 	size_t uValidCount = 0;
 	for (int i = 0; i < FileCount && i < MAX_FILECOUNT; i++) {
 		char strFileName[MAX_PATH] = { 0 };
@@ -214,7 +212,6 @@ int libmediaplayer_impl::GetLocalAudioPlayingParams(rvc_media_player_param_t* pP
 	Tmp = NULL;
 
 	pParam->m_uFilesCount = uValidCount;
-	m_pHostApi->Debug(MEDIA_LOG_DEBUG, "pParam m_uFilesCount = %d", pParam->m_uFilesCount);
 	if (uValidCount > 0) {
 		iRet = 0;
 	}
@@ -227,8 +224,6 @@ int libmediaplayer_impl::StartPlayLocalAudio(const char* pAudioNames)
 {
 	int iRet = -1;
 
-	m_pHostApi->Debug(MEDIA_LOG_DEBUG, "StartPlayLocalAudio %s.", pAudioNames);
-
 	m_stPlayConfig.eMode = MEDIA_LOCALAUDIO;
 	iRet = m_pHostApi->LoadPlayConfig(m_stPlayConfig);
 	m_stPlayConfig.eMode = MEDIA_LOCALAUDIO;
@@ -236,10 +231,6 @@ int libmediaplayer_impl::StartPlayLocalAudio(const char* pAudioNames)
 		m_pHostApi->Debug(MEDIA_LOG_ERROR, "Load Configuration failed while play local audio!");
 		return iRet;
 	}
-	else {
-		m_pHostApi->Debug(MEDIA_LOG_DEBUG, "Load Configuration succeeded while play local audio!");
-		m_pHostApi->Debug(MEDIA_LOG_DEBUG, "m_stPlayConfig.strRootPath: %s", m_stPlayConfig.strRootPath);
-	}
 
 	rvc_media_player_param_t t_param = { 0 };
 	if (0 != GetLocalAudioPlayingParams(&t_param, pAudioNames)) {
@@ -253,7 +244,6 @@ int libmediaplayer_impl::StartPlayLocalAudio(const char* pAudioNames)
 	t_param.cb = &cb;
 
 	if (0 == m_Player->InitParam(&t_param)) {
-		m_pHostApi->Debug(MEDIA_LOG_DEBUG, "Player Init success!");
 		iRet = m_Player->StartMediaPlay();
 	}
 	else {
@@ -292,8 +282,6 @@ int libmediaplayer_impl::StartPlayMedia(CMediaPlayConfig& config)
 		return iRet;
 	}
 
-	m_pHostApi->Debug(MEDIA_LOG_DEBUG, "pParam m_uFilesCount = %d", t_param.m_uFilesCount);
-
 	play_media_callback_t cb = { 0 };
 	cb.cb_play_media_finished = NULL;
 	cb.user_data = this;

+ 0 - 2
Other/libmediaplayer/packet.cpp

@@ -140,14 +140,12 @@ void packet_queue_destroy(packet_queue_t *q, CMediaHostApi* m_hostapi)
     packet_queue_flush(q);
     SDL_DestroyMutex(q->mutex);
     SDL_DestroyCond(q->packet_cond);
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "packet queue destroy.");
 }
 
 void packet_queue_abort(packet_queue_t *q, CMediaHostApi* m_hostapi)
 {
     SDL_LockMutex(q->mutex);
     q->abort_flag = 1;
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "packet_queue_abort, CondSignal cond.");
     SDL_CondSignal(q->packet_cond);
     SDL_UnlockMutex(q->mutex);
 }

+ 8 - 55
Other/libmediaplayer/player.cpp

@@ -138,7 +138,6 @@ CMediaPlayer::CMediaPlayer(CMediaHostApi* pHostApi)
 		}
 		else {
 			initialized++;
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "initialize SDL success");
 		}
 	}
 }
@@ -166,7 +165,6 @@ CMediaPlayer::~CMediaPlayer()
 
 	if (--initialized == 0){
 		SDL_Quit();
-		m_hostapi->Debug(MEDIA_LOG_INFO, "SDL_Quit");
 	}
 }
 
@@ -197,12 +195,7 @@ static int mediaplay_thread_func(void* arg)
 
 	CMediaPlayer* pPlayer = (CMediaPlayer*)arg;
 
-	pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_DEBUG, "************* enter mediaplay_thread func ************");
-
-	if (0 == open_demux(pPlayer->GetPlayerStat())) {
-		pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_DEBUG, "open_demux function call success.");
-	}
-	else {
+	if (0 != open_demux(pPlayer->GetPlayerStat())) {
 		pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_ERROR, "open_demux function call failed.");
 		return iret;
 	}
@@ -234,7 +227,6 @@ static int mediaplay_thread_func(void* arg)
 					}
 				}
 				else {
-					pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_DEBUG, "---------------stop audio playing thread---------------");
 					baudioplay_thread_exit = true;
 				}
 			}
@@ -251,8 +243,6 @@ static int mediaplay_thread_func(void* arg)
 		return iret;
 	}
 
-	pPlayer->GetMediaHostApi()->Debug(MEDIA_LOG_DEBUG, "************* exit mediaplay_thread func ************");
-
 	return iret;
 }
 
@@ -402,7 +392,6 @@ int CMediaPlayer::UnInitialize_Player_Stat()
 	}
 	
 	SDL_DestroyCond(m_player_stat->m_continue_read_thread);
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_DestroySemaphore m_audio_play_wait_sem.");
 	SDL_DestroySemaphore(m_player_stat->m_audio_play_wait_sem);
 	m_player_stat->m_audio_play_wait_sem = NULL;
 
@@ -430,8 +419,6 @@ int CMediaPlayer::UnInitialize_Player_Stat()
 	frame_queue_destory(&m_player_stat->video_frm_queue);
 	frame_queue_destory(&m_player_stat->audio_frm_queue);
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "av_free player_stat_t.");
-
 	swr_free(&m_player_stat->m_paudio_swr_ctx);
 
 	//if (NULL != m_player_stat->m_paudio_frm) {
@@ -469,14 +456,14 @@ int CMediaPlayer::GetViceVideoDisplayInfo(int* icx, int* icy, int* iwidth, int*
 {
 	int iRet = -1;
 	size_t uCount = SDL_GetNumVideoDisplays();
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays Number is %d.", uCount);
+	//m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays Number is %d.", uCount);
 	SDL_DisplayMode dispalymode[RVC_MAX_DISPLAYNUM] = { 0 };
 	for (size_t i = 0; i < uCount && i < RVC_MAX_DISPLAYNUM; i++) {
 		SDL_GetDesktopDisplayMode(i, &dispalymode[i]);
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} format = %d", i, dispalymode[i].format);
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} w = %d", i, dispalymode[i].w);
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} h = %d", i, dispalymode[i].h);
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} refresh_rate = %d", i, dispalymode[i].refresh_rate);
+		//m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} format = %d", i, dispalymode[i].format);
+		//m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} w = %d", i, dispalymode[i].w);
+		//m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} h = %d", i, dispalymode[i].h);
+		//m_hostapi->Debug(MEDIA_LOG_DEBUG, "VideoDisplays{%d} refresh_rate = %d", i, dispalymode[i].refresh_rate);
 	}
 	if (uCount > 1) {
 		*icx = dispalymode[0].w;
@@ -496,7 +483,7 @@ int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
 	if (0 != Initialize_Player_Stat(pMedia_Player)){
 		return iRet;
 	}
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "initialize player stat success.");
+	//m_hostapi->Debug(MEDIA_LOG_DEBUG, "initialize player stat success.");
 	/* start video display */
 	if (frame_queue_init(&m_player_stat->video_frm_queue, &m_player_stat->video_pkt_queue, VIDEO_PICTURE_QUEUE_SIZE, 1) < 0 ||
 		frame_queue_init(&m_player_stat->audio_frm_queue, &m_player_stat->audio_pkt_queue, SAMPLE_QUEUE_SIZE, 1) < 0)
@@ -505,9 +492,6 @@ int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
 		UnInitialize_Player_Stat();
 		return iRet;
 	}
-	else{
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "frame queue init success!");
-	}
 
 	/* init packet queue */
 	if (packet_queue_init(&m_player_stat->video_pkt_queue, m_hostapi) < 0 ||
@@ -517,9 +501,6 @@ int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
 		UnInitialize_Player_Stat();
 		return iRet;
 	}
-	else{
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "packet queue init success!");
-	}
 
 	/* put end pkt into packet queue */
 	AVPacket flush_pkt = {0};
@@ -540,11 +521,9 @@ int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
 
 	if (m_player_stat->bvice_monitor){
 		if (0 == GetViceVideoDisplayInfo(&m_player_stat->iDisplayCx, &m_player_stat->iDisplayCy, &m_player_stat->iDisplayWidth, &m_player_stat->iDisplayHeight)){
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "Get Vice Video Display Info Success.");
+	
 		}
 	}
-	
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "display cx is %d, cy is %d, width is %d, height is %d.", m_player_stat->iDisplayCx, m_player_stat->iDisplayCy, m_player_stat->iDisplayWidth, m_player_stat->iDisplayHeight);
 
 	iRet = 0;
 
@@ -558,8 +537,6 @@ int CMediaPlayer::SetVolume(uint8_t uVolume)
 	
 	m_uvolume = uVolume * SDL_MIX_MAXVOLUME/100;
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "set audio volume(%d) to %d.", uVolume, m_uvolume);
-
 	iRet = 0;
 
 	return iRet;
@@ -598,7 +575,6 @@ int CMediaPlayer::StartMediaPlay()
 			if (0 != iWaitRet) {
 				if (SDL_MUTEX_TIMEDOUT == iWaitRet) {
 					if (m_bmediaplay_started_flag) {
-						m_hostapi->Debug(MEDIA_LOG_DEBUG, "media play is already started.");
 						break;
 					}
 					else {
@@ -610,7 +586,6 @@ int CMediaPlayer::StartMediaPlay()
 				}
 			}
 			else {
-				m_hostapi->Debug(MEDIA_LOG_INFO, "start media play thread has exit.");
 				bmediaplay_thread_exit = true;
 			}
 		} while (!bmediaplay_thread_exit);
@@ -621,38 +596,29 @@ int CMediaPlayer::StartMediaPlay()
 
 	SDL_UnlockMutex(m_meida_play_start_wait_mutex);
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "wait media play thread.");
 	SDL_WaitThread(m_mediaplay_tid, NULL);
 	m_mediaplay_tid = NULL;
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "media play thread finished.");
 	
 	if (NULL != m_player_stat->m_audio_decode_tid) {
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "wait audio decode thread.");
 		SDL_WaitThread(m_player_stat->m_audio_decode_tid, NULL);
 		m_player_stat->m_audio_decode_tid = NULL;
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "audio decode thread finished.");
 	}
 
 	if (m_player_stat->m_eMType == eVideo_Type) {
 		if (NULL != m_player_stat->m_video_decode_tid) {
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "wait video decode thread.");
 			SDL_WaitThread(m_player_stat->m_video_decode_tid, NULL);
 			m_player_stat->m_video_decode_tid = NULL;
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "video decode thread finished.");
 		}
 
 		if (NULL != m_player_stat->m_video_playing_tid) {
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "wait video playing thread.");
 			SDL_WaitThread(m_player_stat->m_video_playing_tid, NULL);
 			m_player_stat->m_video_playing_tid = NULL;
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "video playing thread finished.");
 		}
 	}
 
 	if (NULL != m_player_stat->m_read_tid) {
 		SDL_WaitThread(m_player_stat->m_read_tid, NULL);
 		m_player_stat->m_read_tid = NULL;
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "demux thread finished.");
 	}
 	
 	ExitMediaPlayingThread();
@@ -667,8 +633,6 @@ int CMediaPlayer::StopMediaPlay()
 {
 	int iRet = -1;
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "StopMediaPlay called.");
-
 	if (NULL == m_player_stat) {
 		return iRet;
 	}
@@ -682,7 +646,6 @@ int CMediaPlayer::StopMediaPlay()
 	SDL_LockMutex(m_meida_play_start_wait_mutex);
 
 	if (NULL != m_player_stat->m_audio_play_wait_sem) {
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_SemPost m_audio_play_wait_sem.");
 		SDL_SemPost(m_player_stat->m_audio_play_wait_sem);
 	}
 
@@ -692,14 +655,10 @@ int CMediaPlayer::StopMediaPlay()
 	frame_queue_signal(&m_player_stat->video_frm_queue);
 	frame_queue_signal(&m_player_stat->audio_frm_queue);
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "set m_player_stat media finished flag to true.");
-
 	SDL_UnlockMutex(m_meida_play_start_wait_mutex);
 
 	iRet = 0;
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "StopMediaPlay exit.");
-
 	return iRet;
 }
 
@@ -712,8 +671,6 @@ int CMediaPlayer::ExitMediaPlayingThread()
 		return iRet;
 	}
 
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "enter ExitMediaPlayingThread call.");
-
 	if(eVideo_Type == m_player_stat->m_eMType){
 		if (m_player_stat->sdl_video.texture) {
 			SDL_DestroyTexture(m_player_stat->sdl_video.texture);
@@ -725,12 +682,10 @@ int CMediaPlayer::ExitMediaPlayingThread()
 		
 		if (m_player_stat->sdl_video.window){
 			SDL_DestroyWindow(m_player_stat->sdl_video.window);
-			m_hostapi->Debug(MEDIA_LOG_DEBUG, "Destroy Window.");
 		}
 	}
 
 	if (m_player_stat->m_prvc_cb){
-		m_hostapi->Debug(MEDIA_LOG_DEBUG, "cb_play_media_finished callback.");
 		if (m_player_stat->m_prvc_cb->cb_play_media_finished) {
 			m_player_stat->m_prvc_cb->cb_play_media_finished(m_player_stat->m_prvc_cb->user_data);
 		}
@@ -741,8 +696,6 @@ int CMediaPlayer::ExitMediaPlayingThread()
 	m_bplaying = false;
 
 	iRet = 0;
-	
-	m_hostapi->Debug(MEDIA_LOG_DEBUG, "Leave ExitMediaPlayingThread call.");
 
 	return iRet;
 }

+ 0 - 31
Other/libmediaplayer/video.cpp

@@ -138,7 +138,6 @@ static int video_decode_thread(void *arg)
 		AVRational frame_rate = av_guess_frame_rate(is->m_pfmt_ctx[is->m_icurrent_index], is->m_pvideo_stream[is->m_icurrent_index], NULL);
         got_picture = video_decode_frame(is->m_pvcodec_ctx[is->m_icurrent_index], &is->video_pkt_queue, p_frame, is->rvc_hostapi);
         if (got_picture < 0){
-			is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "video_decode_frame < 0, goto end and set video_finished flag to true.");
             goto exit;
         }
 
@@ -150,7 +149,6 @@ static int video_decode_thread(void *arg)
         av_frame_unref(p_frame);
 
         if (ret < 0){
-			is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "queue_picture return -1, goto end and set video_finished flag to true.");
             goto exit;
         }
 		else{
@@ -377,12 +375,6 @@ static int video_playing_thread(void *arg)
 
 	uint32_t uWindFlag = get_video_playing_wind_flag(is->m_eWindType);
 
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d %d %d %d %d", __FUNCTION__, __LINE__, 
-		is->iDisplayCx,
-		is->iDisplayCy,
-		is->sdl_video.rect.w,
-		is->sdl_video.rect.h);
-
 	// 1. 创建SDL窗口,SDL 2.0支持多窗口
 	//    SDL_Window即运行程序后弹出的视频窗口,同SDL 1.x中的SDL_Surface
 	is->sdl_video.window = SDL_CreateWindow("player",
@@ -398,7 +390,6 @@ static int video_playing_thread(void *arg)
 		return -1;
 	}
 	else {
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL Create Window success.");
 		//SDL_HideWindow(is->sdl_video.window);
 #ifdef _WIN32
 		SDL_SysWMinfo info;
@@ -406,7 +397,6 @@ static int video_playing_thread(void *arg)
 		SDL_VERSION(&info.version);
 		if (SDL_GetWindowWMInfo(is->sdl_video.window, &info)) {
 			hwnd = info.info.win.window;
-			is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "SDL_GetWindowWMInfo success.");
 			SetWindowPos(hwnd,
 				HWND_TOPMOST,
 				is->iDisplayCx,
@@ -425,23 +415,15 @@ static int video_playing_thread(void *arg)
 
 	int cx = 0, cy = 0;
 	SDL_GetWindowPosition(is->sdl_video.window, &cx, &cy);
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "window flag is 0x%08x, cx = %d, cy = %d.", SDL_GetWindowFlags(is->sdl_video.window), cx, cy);
 
 	// 2. 创建SDL_Renderer
 	//    SDL_Renderer:渲染器
 	int iNum = SDL_GetNumRenderDrivers();
 	int iRenderindex = -1;
-	static bool blog = true;
-	if (blog) {
-		is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "SDL_GetNumRenderDrivers %d.", iNum);
-	}
 	
 	for (int index = 0; index < iNum; index++){
 		SDL_RendererInfo info = {0};
 		SDL_GetRenderDriverInfo(index, &info);
-		if (blog) {
-			is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "%d render driver name is %s.", index, info.name);
-		}
 #ifdef _WIN32
 #else
 		if (strstr(info.name, "software")) {
@@ -462,11 +444,6 @@ static int video_playing_thread(void *arg)
 
 	SDL_RendererInfo RenderInfo;
 	SDL_GetRendererInfo(is->sdl_video.renderer, &RenderInfo);
-	if (blog) {
-		is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "render driver name is %s.", RenderInfo.name);
-		is->rvc_hostapi->Debug(MEDIA_LOG_INFO, "render flag is %d.", RenderInfo.flags);
-	}
-	blog = false;
 
 	// 3. 创建SDL_Texture
 	//    一个SDL_Texture对应一帧YUV数据,同SDL 1.x中的SDL_Overlay
@@ -493,7 +470,6 @@ static int video_playing_thread(void *arg)
         // 立即显示当前帧,或延时remaining_time后再显示
         video_refresh(is, &remaining_time);
 		//remaining_time += 0.020;
-		//is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d, remaining_time = %f.", __FUNCTION__, __LINE__, remaining_time);
 
 		SDL_Event event;
 		while(SDL_PollEvent(&event))
@@ -547,7 +523,6 @@ static int open_video_playing(void* arg)
 			iplay_video_height,
 			1
 		);
-		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "av_image_get_buffer_size is %d.", buf_size);
 		// buffer将作为p_frm_yuv的视频数据缓冲区
 		buffer = (uint8_t*)av_malloc(buf_size);
 		if (NULL == buffer) {
@@ -593,9 +568,6 @@ static int open_video_playing(void* arg)
 			is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "sws_getContext() failed.");
 			return iret;
 		}
-		else {
-			is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d is->m_pimg_convert_ctx[%d] = 0x%08x.", __FUNCTION__, __LINE__, index, is->m_pimg_convert_ctx[index]);
-		}
 
 		// SDL_Rect赋值
 		is->sdl_video.rect.x = 0;
@@ -681,12 +653,9 @@ static int open_video_stream(player_stat_t *is)
 int open_video(player_stat_t *is)
 {
 	int iret = -1;
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "enter open_video()");
 	if (0 == open_video_stream(is)) {
 		iret = open_video_playing(is);
 	}
-  
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "exit open_video()");
 
     return iret;
 }