Merge commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf'

* commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf':
  h264: merge the two reinit blocks in slice_header_parse()

Merged-by: Clément Bœsch <clement@stupeflix.com>
This commit is contained in:
Clément Bœsch 2016-07-01 14:17:56 +02:00
commit 2021326f99

View File

@ -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) {