---
libavcodec/h264.c | 13 ++++++++++++-
libavcodec/h264.h | 1 +
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 36d0e42..baeebf1 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1277,6 +1277,8 @@ static int decode_update_thread_context(AVCodecContext
*dst,
h->prev_frame_num = h->frame_num;
h->outputed_poc = h->next_outputed_poc;
+ h->setup_finished = 0;
+
return err;
}
@@ -1286,6 +1288,12 @@ int ff_h264_frame_start(H264Context *h)
int i;
const int pixel_shift = h->pixel_shift;
+ if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME) &&
+ !s->avctx->thread_safe_callbacks && h->setup_finished) {
+ av_log(h->s.avctx, AV_LOG_ERROR, "Starting new frames after
thread_finish_setup\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (ff_MPV_frame_start(s, s->avctx) < 0)
return -1;
ff_er_frame_start(s);
@@ -1562,8 +1570,10 @@ static void decode_postinit(H264Context *h, int
setup_finished)
av_log(s->avctx, AV_LOG_DEBUG, "no picture\n");
}
- if (setup_finished)
+ if (setup_finished) {
ff_thread_finish_setup(s->avctx);
+ h->setup_finished = 1;
+ }
}
static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y,
@@ -4173,6 +4183,7 @@ out:
field_end(h, 0);
h->context_reinitialized = 0;
+ h->setup_finished = 0;
if (!h->next_output_pic) {
/* Wait for second field. */
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index e4d4ea1..4c5069e 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -501,6 +501,7 @@ typedef struct H264Context {
int cabac_init_idc;
+ int setup_finished;
/**
* @name Members for slice based multithreading
* @{
--
1.7.12.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel