Răsfoiți Sursa

Z991239-2055 #comment fix: 解决音频播放少一个字问题

陈礼鹏80274480 4 ani în urmă
părinte
comite
05687eca4c

+ 1 - 1
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -903,7 +903,7 @@ void* StartMediaPlayFunc(void* param)
 				strncpy(config.strVideoRunTime_S, "09:00:00", sizeof(config.strVideoRunTime_S));
 				strncpy(config.strVideoRunTime_E, "17:30:00", sizeof(config.strVideoRunTime_E));
 				entity->m_pMediaPlayer[entity->m_mediaParam.nCfgInx]->PlayMedia(config);
-				Sleep(2000);
+				Sleep(800);
 			}
 			else if ('P' == item.type)
 			{//play Image

+ 2 - 5
Other/libmediaplayer/audio.cpp

@@ -131,7 +131,7 @@ static int audio_decode_thread(void *arg)
             tb = { 1, p_frame->sample_rate };
 
 			//从frame队列找到一个可写的空间,若未停止则一直等待,已停止时返回NULL
-			if (!(af = frame_queue_peek_writable(&is->audio_frm_queue, !is->bread_finished))) {
+			if (!(af = frame_queue_peek_writable(&is->audio_frm_queue, true))) {
 				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "frame_queue_peek_writable return NULL, goto end.");
 				goto the_end;
 			}
@@ -151,8 +151,6 @@ static int audio_decode_thread(void *arg)
 the_end:
 
     av_frame_free(&p_frame);
-	//SDL_Delay(100);
-	//is->abort_request = 1;
 	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "audio decode thread exit, thread id is %u, and is->abort_request = %d", SDL_ThreadID(), is->abort_request);
     
 	return ret;
@@ -234,7 +232,6 @@ static int audio_resample(player_stat_t *is, int64_t audio_callback_time)
 #endif
 
     // 若队列头部可读,则由af指向可读帧
-	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d is->bread_finished=%d", __FUNCTION__, __LINE__, is->bread_finished);
 	if (!(af = frame_queue_peek_readable(&is->audio_frm_queue, !is->bread_finished))) {
 		is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d abort_request flag is true, function return", __FUNCTION__, __LINE__);
 		return -2;
@@ -426,7 +423,7 @@ static int open_audio_playing(void *arg)
 	//SDL_PauseAudioDevice(idev, 0);
 
 	while (is->abort_request == 0){
-		SDL_Delay(10);
+		SDL_Delay(1);
 	}
 	is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "----------%s:%d before SDL Close Audio", __FUNCTION__, __LINE__);
 	SDL_CloseAudio();