[FFmpeg-devel] [PATCH] avcodec/h264dec: Fix regression with "make fate-h264-attachment-631 THREADS=8"
Michael Niedermayer
michael at niedermayer.cc
Mon Jan 23 23:35:01 EET 2017
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/h264_picture.c | 2 +-
libavcodec/h264dec.c | 4 +++-
libavcodec/h264dec.h | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index f634d2a1a7..2313eff5d7 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -185,7 +185,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
ff_vdpau_h264_picture_complete(h);
#endif
- if (!in_setup && !h->droppable)
+ if (!in_setup && !h->droppable && h->has_slice)
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
h->picture_structure == PICT_BOTTOM_FIELD);
emms_c();
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 4ecaec267c..6f2bd79628 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -607,6 +607,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
int idr_cleared=0;
int i, ret = 0;
+ h->has_slice = 0;
h->nal_unit_type= 0;
h->max_contexts = h->nb_slice_ctx;
@@ -672,6 +673,7 @@ again:
h->has_recovery_point = 1;
case H264_NAL_SLICE:
sl->gb = nal->gb;
+ h->has_slice = 1;
if ((err = ff_h264_decode_slice_header(h, sl, nal)))
break;
@@ -839,7 +841,7 @@ end:
}
#endif /* CONFIG_ERROR_RESILIENCE */
/* clean up */
- if (h->cur_pic_ptr && !h->droppable) {
+ if (h->cur_pic_ptr && !h->droppable && h->has_slice) {
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX,
h->picture_structure == PICT_BOTTOM_FIELD);
}
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index c8b7e663b3..52e2e55b2a 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -541,6 +541,8 @@ typedef struct H264Context {
int has_recovery_point;
+ int has_slice;
+
int missing_fields;
/* for frame threading, this is set to 1
--
2.11.0
More information about the ffmpeg-devel
mailing list