Commit de625312 authored by Timothy Gu's avatar Timothy Gu

Merge commit 'e26c6414'

* commit 'e26c6414':
  h264: discard slices of redundant pictures right after parsing the slice header

Conflicts:
	libavcodec/h264_slice.c
	libavcodec/h264dec.c

TODO: fix indentation
Merged-by: 's avatarTimothy Gu <timothygu99@gmail.com>
parents e0c8250a e26c6414
...@@ -1738,6 +1738,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, ...@@ -1738,6 +1738,10 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl,
if (ret < 0) if (ret < 0)
return ret; return ret;
// discard redundant pictures
if (sl->redundant_pic_count > 0)
return 0;
if (sl->first_mb_addr == 0 || !h->current_slice) { if (sl->first_mb_addr == 0 || !h->current_slice) {
if (h->setup_finished) { if (h->setup_finished) {
av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n"); av_log(h->avctx, AV_LOG_ERROR, "Too many fields\n");
......
...@@ -799,6 +799,9 @@ again: ...@@ -799,6 +799,9 @@ again:
if ((err = ff_h264_decode_slice_header(h, sl, nal))) if ((err = ff_h264_decode_slice_header(h, sl, nal)))
break; break;
if (sl->redundant_pic_count > 0)
break;
if (h->sei.recovery_point.recovery_frame_cnt >= 0) { if (h->sei.recovery_point.recovery_frame_cnt >= 0) {
const int sei_recovery_frame_cnt = h->sei.recovery_point.recovery_frame_cnt; const int sei_recovery_frame_cnt = h->sei.recovery_point.recovery_frame_cnt;
...@@ -845,7 +848,6 @@ again: ...@@ -845,7 +848,6 @@ again:
#endif #endif
} }
if (sl->redundant_pic_count == 0) {
if (avctx->hwaccel) { if (avctx->hwaccel) {
ret = avctx->hwaccel->decode_slice(avctx, ret = avctx->hwaccel->decode_slice(avctx,
nal->raw_data, nal->raw_data,
...@@ -864,7 +866,6 @@ again: ...@@ -864,7 +866,6 @@ again:
#endif #endif
} else } else
context_count++; context_count++;
}
break; break;
case H264_NAL_DPA: case H264_NAL_DPA:
case H264_NAL_DPB: case H264_NAL_DPB:
......
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