Commit d6e0ce6b authored by lorenm's avatar lorenm

reduce stutter if we learn too late that the stream contains B-frames.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3801 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 74e3417f
...@@ -6111,22 +6111,26 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -6111,22 +6111,26 @@ static int decode_frame(AVCodecContext *avctx,
Picture *prev = h->delayed_pic[0]; Picture *prev = h->delayed_pic[0];
Picture *out; Picture *out;
if(cur->pict_type == B_TYPE if(s->low_delay
&& (cur->pict_type == B_TYPE
|| (!h->sps.gaps_in_frame_num_allowed_flag || (!h->sps.gaps_in_frame_num_allowed_flag
&& prev && cur->poc - prev->poc > 2)){ && prev && cur->poc - prev->poc > 2))){
s->low_delay = 0; s->low_delay = 0;
s->avctx->has_b_frames = 1; s->avctx->has_b_frames = 1;
if(prev && prev->poc > cur->poc)
// too late to display this frame
cur = prev;
} }
if(s->low_delay || !prev || cur->pict_type == B_TYPE) if(s->low_delay || !prev || cur->pict_type == B_TYPE)
out = cur; out = cur;
else{ else
out = prev; out = prev;
if(prev->reference == 1) if(s->low_delay || !prev || out == prev){
if(prev && prev->reference == 1)
prev->reference = 0; prev->reference = 0;
}
if(!s->low_delay && (!prev || out == prev))
h->delayed_pic[0] = cur; h->delayed_pic[0] = cur;
}
*pict= *(AVFrame*)out; *pict= *(AVFrame*)out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment