Mercurial > libavcodec.hg
changeset 2410:9d780478f8a5 libavcodec
reduce stutter if we learn too late that the stream contains B-frames.
author | lorenm |
---|---|
date | Tue, 04 Jan 2005 10:26:47 +0000 |
parents | 26778a857b5b |
children | 0427eb3579b6 |
files | h264.c |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Tue Jan 04 01:12:48 2005 +0000 +++ b/h264.c Tue Jan 04 10:26:47 2005 +0000 @@ -6111,22 +6111,26 @@ 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; + h->delayed_pic[0] = cur; } - if(!s->low_delay && (!prev || out == prev)) - h->delayed_pic[0] = cur; *pict= *(AVFrame*)out; }