Browse Source

#IQRV #comment [localmediaplay]优化本地播放实体的稳定性问题

陈礼鹏80274480 4 years ago
parent
commit
498fae8b94
2 changed files with 4 additions and 2 deletions
  1. 1 1
      Other/libmediaplayer/player.cpp
  2. 3 1
      Other/libmediaplayer/video.cpp

+ 1 - 1
Other/libmediaplayer/player.cpp

@@ -409,7 +409,7 @@ int CMediaPlayer::InitParam(rvc_media_player_param_t* pMedia_Player)
 	}
 
 	/* put end pkt into packet queue */
-	AVPacket flush_pkt = {0};
+	AVPacket flush_pkt;
 	flush_pkt.data = NULL;
 	packet_queue_put(&m_player_stat->video_pkt_queue, &flush_pkt, m_hostapi);
 	packet_queue_put(&m_player_stat->audio_pkt_queue, &flush_pkt, m_hostapi);

+ 3 - 1
Other/libmediaplayer/video.cpp

@@ -63,7 +63,7 @@ static int video_decode_frame(AVCodecContext *p_codec_ctx, packet_queue_t *p_pkt
                 else if (ret == AVERROR(EAGAIN))
                 {
 					//hostapi->Debug(MEDIA_LOG_DEBUG,"video avcodec_receive_frame(): output is not available in this state - " "user must try to send new input");
-					//av_usleep(RVC_DEFAULT_SLEEP_TIME);
+					av_usleep(2);
                     break;
                 }
                 else
@@ -95,6 +95,8 @@ static int video_decode_frame(AVCodecContext *p_codec_ctx, packet_queue_t *p_pkt
             //    pkt.pos变量可以标识当前packet在视频文件中的地址偏移
 			int isend_ret = -1;
 			isend_ret = avcodec_send_packet(p_codec_ctx, &pkt);
+			av_usleep(2);
+			//hostapi->Debug(MEDIA_LOG_DEBUG, "%s:%d after avcodec_send_packet.", __FUNCTION__, __LINE__);
 			if (0 != isend_ret){
 				if (AVERROR(EAGAIN) == isend_ret) {
 					hostapi->Debug(MEDIA_LOG_DEBUG, "receive_frame and send_packet both returned EAGAIN, which is an API violation.");