diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 359c6a9d4d..30594c1ef6 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1414,8 +1414,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl) } } - if (h->context_initialized && - (must_reinit || needs_reinit)) { + if (!h->context_initialized || must_reinit || needs_reinit) { h->context_initialized = 0; if (sl != h->slice_ctx) { av_log(h->avctx, AV_LOG_ERROR, @@ -1435,7 +1434,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl) return ret; h->avctx->pix_fmt = ret; - av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, " + av_log(h->avctx, AV_LOG_VERBOSE, "Reinit context to %dx%d, " "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt)); if ((ret = h264_slice_header_init(h)) < 0) { @@ -1444,23 +1443,6 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl) return ret; } } - if (!h->context_initialized) { - if (sl != h->slice_ctx) { - av_log(h->avctx, AV_LOG_ERROR, - "Cannot (re-)initialize context during parallel decoding.\n"); - return AVERROR_PATCHWELCOME; - } - - if ((ret = get_pixel_format(h, 1)) < 0) - return ret; - h->avctx->pix_fmt = ret; - - if ((ret = h264_slice_header_init(h)) < 0) { - av_log(h->avctx, AV_LOG_ERROR, - "h264_slice_header_init() failed\n"); - return ret; - } - } frame_num = get_bits(&sl->gb, sps->log2_max_frame_num); if (!first_slice) {