Commit 9ba43e50 authored by Michael Niedermayer's avatar Michael Niedermayer

h264: Fix frame sync / random access handling.

It seems I have misunderstood the spec when I implemented this
originally.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fba67773
...@@ -3906,13 +3906,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ ...@@ -3906,13 +3906,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
(hx->nal_unit_type == NAL_IDR_SLICE); (hx->nal_unit_type == NAL_IDR_SLICE);
if (h->recovery_frame == h->frame_num) { if (h->recovery_frame == h->frame_num) {
h->sync |= 1; s->current_picture_ptr->sync |= 1;
h->recovery_frame = -1; h->recovery_frame = -1;
} }
h->sync |= !!s->current_picture_ptr->f.key_frame; h->sync |= !!s->current_picture_ptr->f.key_frame;
h->sync |= 3*!!(s->flags2 & CODEC_FLAG2_SHOW_ALL); 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 (h->current_slice == 1) {
if(!(s->flags2 & CODEC_FLAG2_CHUNKS)) { if(!(s->flags2 & CODEC_FLAG2_CHUNKS)) {
...@@ -4129,13 +4129,11 @@ not_extra: ...@@ -4129,13 +4129,11 @@ not_extra:
field_end(h, 0); field_end(h, 0);
*data_size = 0; /* Wait for second field. */ *data_size = 0; /* Wait for second field. */
if (h->next_output_pic && h->next_output_pic->sync) { if (h->next_output_pic && (h->next_output_pic->sync || h->sync>1)) {
if(h->sync>1 || h->next_output_pic->f.pict_type != AV_PICTURE_TYPE_B){
*data_size = sizeof(AVFrame); *data_size = sizeof(AVFrame);
*pict = *(AVFrame*)h->next_output_pic; *pict = *(AVFrame*)h->next_output_pic;
} }
} }
}
assert(pict->data[0] || !*data_size); assert(pict->data[0] || !*data_size);
ff_print_debug_info(s, pict); ff_print_debug_info(s, pict);
......
...@@ -654,8 +654,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ ...@@ -654,8 +654,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
print_long_term(h); 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){ 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 |= 1;
s->current_picture_ptr->sync |= h->sync;
} }
return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0; return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment