diff options
author | Loren Merritt <lorenm@u.washington.edu> | 2005-01-04 10:26:47 +0000 |
---|---|---|
committer | Loren Merritt <lorenm@u.washington.edu> | 2005-01-04 10:26:47 +0000 |
commit | 1b2dcdc1e06a0053329986adc26fcbc19548d7be (patch) | |
tree | 5a3c12fc811dc5bd058f8f35c53846fcee9db4d5 | |
parent | 2d74541476e268a443b65987d212503dd628bd91 (diff) | |
download | ffmpeg-1b2dcdc1e06a0053329986adc26fcbc19548d7be.tar.gz |
reduce stutter if we learn too late that the stream contains B-frames.
Originally committed as revision 3801 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index bf29af6053..a5b48b1692 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -6111,22 +6111,26 @@ static int decode_frame(AVCodecContext *avctx, Picture *prev = h->delayed_pic[0]; 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 - && prev && cur->poc - prev->poc > 2)){ + && prev && cur->poc - prev->poc > 2))){ s->low_delay = 0; 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) out = cur; - else{ + else out = prev; - if(prev->reference == 1) + if(s->low_delay || !prev || out == prev){ + if(prev && prev->reference == 1) prev->reference = 0; - } - if(!s->low_delay && (!prev || out == prev)) h->delayed_pic[0] = cur; + } *pict= *(AVFrame*)out; } |