summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-11-10 20:24:41 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-11-10 20:24:41 +0000
commit44be1d6478cd1549ec06d06d06db46c4287a3782 (patch)
tree75355a7d0dd2937f1b6f2721e7906db7918bd8be /libavcodec
parent51ae2142d5ec6c00621f662631b6347bc1b2669c (diff)
Try to fix has_b_frame calculation for open gop files.
Fixes issue1523 Originally committed as revision 20504 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8b30eee1ee..d148c010cb 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -7795,7 +7795,7 @@ static int decode_frame(AVCodecContext *avctx,
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){
Picture *out = s->current_picture_ptr;
Picture *cur = s->current_picture_ptr;
- int i, pics, cross_idr, out_of_order, out_idx;
+ int i, pics, out_of_order, out_idx;
field_end(h);
@@ -7899,15 +7899,15 @@ static int decode_frame(AVCodecContext *avctx,
out = h->delayed_pic[i];
out_idx = i;
}
- cross_idr = !!h->delayed_pic[i] || h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset;
-
- out_of_order = !cross_idr && out->poc < h->outputed_poc;
+ if(s->avctx->has_b_frames == 0 && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
+ h->outputed_poc= INT_MIN;
+ out_of_order = out->poc < h->outputed_poc;
if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames)
{ }
else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT)
|| (s->low_delay &&
- ((!cross_idr && out->poc > h->outputed_poc + 2)
+ ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
|| cur->pict_type == FF_B_TYPE)))
{
s->low_delay = 0;
@@ -7922,6 +7922,9 @@ static int decode_frame(AVCodecContext *avctx,
if(!out_of_order && pics > s->avctx->has_b_frames){
*data_size = sizeof(AVFrame);
+ if(out_idx==0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset)) {
+ h->outputed_poc = INT_MIN;
+ } else
h->outputed_poc = out->poc;
*pict= *(AVFrame*)out;
}else{