[FFmpeg-cvslog] h264: Fix frame sync / random access handling.
Michael Niedermayer
git at videolan.org
Tue Jan 3 13:51:56 CET 2012
ffmpeg | branch: release/0.9 | Michael Niedermayer <michaelni at gmx.at> | Sat Dec 31 22:16:57 2011 +0100| [2a442eb70fcb380c043bae62328a89217c725bb0] | committer: Carl Eugen Hoyos
h264: Fix frame sync / random access handling.
It seems I have misunderstood the spec when I implemented this
originally.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 9ba43e50efa2483fb3ca1e3f62a474db7dd3ac8d)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a442eb70fcb380c043bae62328a89217c725bb0
---
libavcodec/h264.c | 8 +++-----
libavcodec/h264_refs.c | 3 +--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 0b90d37..fbe4e36 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3901,13 +3901,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
(hx->nal_unit_type == NAL_IDR_SLICE);
if (h->recovery_frame == h->frame_num) {
- h->sync |= 1;
+ s->current_picture_ptr->sync |= 1;
h->recovery_frame = -1;
}
h->sync |= !!s->current_picture_ptr->f.key_frame;
h->sync |= 3*!!(s->flags2 & CODEC_FLAG2_SHOW_ALL);
- s->current_picture_ptr->sync = h->sync;
+ s->current_picture_ptr->sync |= h->sync;
if (h->current_slice == 1) {
if(!(s->flags2 & CODEC_FLAG2_CHUNKS)) {
@@ -4103,11 +4103,9 @@ static int decode_frame(AVCodecContext *avctx,
field_end(h, 0);
*data_size = 0; /* Wait for second field. */
- if (h->next_output_pic && h->next_output_pic->sync) {
- if(h->sync>1 || h->next_output_pic->f.pict_type != AV_PICTURE_TYPE_B){
+ if (h->next_output_pic && (h->next_output_pic->sync || h->sync>1)) {
*data_size = sizeof(AVFrame);
*pict = *(AVFrame*)h->next_output_pic;
- }
}
}
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index d030fec..8432a8a 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -654,8 +654,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
print_long_term(h);
if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){
- h->sync |= 1;
- s->current_picture_ptr->sync |= h->sync;
+ s->current_picture_ptr->sync |= 1;
}
return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
More information about the ffmpeg-cvslog
mailing list