ijkplayer

1、延迟
降低延迟处理 ff_ffplay

2、播放RTSP视频实时流,接着播放HTTP流第一次无法播放的问题

ijkmp_prepare_async()=0
Opening 'http://192.168.1.254:8192' for reading
Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
Hit DNS cache hostname = 192.168.1.254
ijkmp_start()
ijkmp_start()=-3
2019-05-07 10:30:40.693458+0800 IJKMediaDemo[18929:6014743] invalidateRenderBuffer
2019-05-07 10:30:40.705185+0800 IJKMediaDemo[18929:6014743] invalidateRenderBuffer
2019-05-07 10:30:40.708561+0800 IJKMediaDemo[18929:6014743] IJKMPMoviePlayBackStateDidChange 0: stoped
2019-05-07 10:30:40.708630+0800 IJKMediaDemo[18929:6014743] playbackStateDidChange: IJKMPMovieFinishReasonPlaybackEnded: 0
2019-05-07 10:30:40.708673+0800 IJKMediaDemo[18929:6014743] IJKMPMoviePlayBackStateDidChange 0: stoped
2019-05-07 10:30:40.717137+0800 IJKMediaDemo[18929:6014743] OK setup GL
2019-05-07 10:30:40.717232+0800 IJKMediaDemo[18929:6014743] IJKSDLGLView: setupDisplay not ready
2019-05-07 10:30:40.719207+0800 IJKMediaDemo[18929:6014743] IJKSDLGLView: setupDisplay not ready
2019-05-07 10:30:40.719236+0800 IJKMediaDemo[18929:6014743] IJKSDLGLView: setupDisplay not ready
av_read_frame error: AVERROR_EXIT
wait for video_refresh_tid
SDL_Overlay(ffmpeg): overlay_free_l(0x281758770)
SDL_Overlay(ffmpeg): overlay_free_l(0x281758850)
SDL_Overlay(ffmpeg): overlay_free_l(0x2817588c0)
ijkmp_shutdown_l()=void
ijkmp_set_inject_opaque(0x0)
ijkmp_set_inject_opaque()=void
ijkmp_set_ijkio_inject_opaque(0x0)
ijkmp_set_ijkio_inject_opaque()=void
ijkmp_dec_ref(): ref=0
ijkmp_shutdown_l()
ijkmp_shutdown_l()=void
aout_close_audio()
Connection to tcp://192.168.1.254:8192 failed: Connection refused
Hit dns cache but connect fail hostname = 192.168.1.254, ip = 
http://192.168.1.254:8192: Connection refused
2019-05-07 10:30:41.714488+0800 IJKMediaDemo[18929:6014743] FFP_MSG_ERROR: 0
2019-05-07 10:30:41.714982+0800 IJKMediaDemo[18929:6014743] IJKMPMoviePlayBackStateDidChange 0: stoped
2019-05-07 10:30:41.715109+0800 IJKMediaDemo[18929:6014743] playbackStateDidChange: IJKMPMovieFinishReasonPlaybackError: 1

现象:使用带Wi-Fi的相机,分别去播放RTSP流和HTTP流,播放完RTSP流以后切换HTTP 播放失败,上述打印信息,失败后接着再次播放HTTP流才能播放成功。

原因:IJKPlayer中默认使用了dns cache。缓存的地址信息中包含host和port,而只用hostname作为key新增或查询dns cache,当重定向的url与之前地址host相同port不同时就导致继续使用了旧的dns cache。

解法:所以在添加dns cache时应该用hostname+port作为key,可参考zhanggao提的问题ijkplayer/issues/3700。
或者干脆不使用dns cache, 我使用的是以下这种方法,目前木有发现问题。
[options setFormatOptionIntValue:1 forKey:@"dns_cache_clear"];

你可能感兴趣的:(ijkplayer)