Переглянути джерело

Z991239-2055 #comment fix: 修复播放广告时用异常文件(不含video流)存在异常问题

陈礼鹏80274480 4 роки тому
батько
коміт
46f396145d
2 змінених файлів з 5 додано та 3 видалено
  1. 4 3
      Other/libmediaplayer/demux.cpp
  2. 1 0
      Other/libmediaplayer/player.cpp

+ 4 - 3
Other/libmediaplayer/demux.cpp

@@ -56,22 +56,23 @@ 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.", is->strPlayLists[index], a_idx);
+				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s Find a audio stream, index %d, eMType is %d.", is->strPlayLists[index], a_idx, is->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.", is->strPlayLists[index], v_idx);
+				is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s Find a video stream, index %d, eMType is %d.", is->strPlayLists[index], v_idx, is->eMType);
 			}
 			if (a_idx != -1 && v_idx != -1){
 				break;
 			}
 		}
 
-		if (a_idx == -1 && v_idx == -1){
+		if ((a_idx == -1 && v_idx == -1) || (eVideo_Type == is->eMType && v_idx == -1)){
 			is->rvc_hostapi->Debug(MEDIA_LOG_DEBUG, "%s can not find any audio/video stream.", is->strPlayLists[index]);
 			ret = -1;
 			if (NULL != p_fmt_ctx){
 				avformat_close_input(&p_fmt_ctx);
+				is->p_fmt_ctx[index] = NULL;
 			}
 			break;
 		}

+ 1 - 0
Other/libmediaplayer/player.cpp

@@ -410,6 +410,7 @@ void CMediaPlayer::StartMediaPlay()
 	}
 	else{
 		m_hostapi->Debug(MEDIA_LOG_DEBUG, "open_demux function call failed.");
+		ExitMediaPlayingThread();
 		return;
 	}