支持RTSP协议,参照:www.jianshu.com/p/69b26da21fa5
全部弄好后,发现延迟不满意,于是自己动手丰衣足食:
主要也就是修改了:
ijkmedia>ijkplayer>ff_ffplay.c这个文件
static double vp_duration(VideoState *is, Frame *vp, Frame *nextvp) {
if(vp->serial == nextvp->serial) {
doubleduration = nextvp->pts - vp->pts;
if(isnan(duration) || duration <=0|| duration > is->max_frame_duration)
return vp->duration;
else
return duration;
}else{
return 0.0;
}
}
直接换成:
static double vp_duration(VideoState*is,Frame*vp,Frame*nextvp) {
return vp->duration;
}
2、接着改staticintffplay_video_thread这个方法:
static int ffplay_video_thread(void*arg){
FFPlayer*ffp = arg;
VideoState*is = ffp->is;
AVFrame*frame =av_frame_alloc();
doublepts;
doubleduration;
intret;
AVRationaltb = is->video_st->time_base;
//注释掉
//AVRational frame_rate = av_guess_frame_rate(is->ic, is->video_st, NULL);
//......中间代码太长,不贴上了
//注释掉
//duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational) {frame_rate.den, frame_rate.num}) : 0);
//直接写出
duration=0.01;
//........
}
改完后发现延迟非常满意
网友评论
//AVRational frame_rate = av_guess_frame_rate(is->ic, is->video_st, NULL);
//duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational) {frame_rate.den, frame_rate.num}) : 0);