diff options
author | Alexander Strange <astrange@ithinksw.com> | 2011-04-18 00:47:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-18 00:47:35 +0200 |
commit | 7e2eb4bacd70541702bd086ab2a39cb7653d314e (patch) | |
tree | 45898e55103fffe67ebe5a5454522688fd40cdca /libavcodec/h264.c | |
parent | 2d2b5a1421ee652f76a756024d0210f0b6455fda (diff) | |
download | ffmpeg-7e2eb4bacd70541702bd086ab2a39cb7653d314e.tar.gz |
Merge remote-tracking branch 'ffmpeg-mt/master'
* ffmpeg-mt/master:
Release unused pictures even when not calling ff_h264_frame_start()
h264: Fix decoding race condition with PAFF
h264: cosmetic whitespace change
Duplicate Fix REBASE_PICTURE with h.264
Not pulled Update test scripts to use ffmpeg instead of ffmpeg_g
Duplicate Fix ffmpeg-mt fixme in h264
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 48a2455b22..c64e6fb3f9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -715,7 +715,7 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex copy_fields(h, h1, short_ref, cabac_init_idc); copy_picture_range(h->short_ref, h1->short_ref, 32, s, s1); - copy_picture_range(h->long_ref, h1->long_ref, 32, s, s1); + copy_picture_range(h->long_ref, h1->long_ref, 32, s, s1); copy_picture_range(h->delayed_pic, h1->delayed_pic, MAX_DELAYED_PIC_COUNT+2, s, s1); h->last_slice_type = h1->last_slice_type; @@ -930,6 +930,8 @@ static void decode_postinit(H264Context *h){ if(out_of_order || pics > s->avctx->has_b_frames){ out->reference &= ~DELAYED_PIC_REF; + out->owner2 = s; // for frame threading, the owner must be the second field's thread + // or else the first thread can release the picture and reuse it unsafely for(i=out_idx; h->delayed_pic[i]; i++) h->delayed_pic[i] = h->delayed_pic[i+1]; } @@ -2049,9 +2051,13 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ s0->first_field = FIELD_PICTURE; } - if((!FIELD_PICTURE || s0->first_field) && ff_h264_frame_start(h) < 0) { - s0->first_field = 0; - return -1; + if(!FIELD_PICTURE || s0->first_field) { + if (ff_h264_frame_start(h) < 0) { + s0->first_field = 0; + return -1; + } + } else { + ff_release_unused_pictures(s, 0); } } if(h != h0) |