}
}
- if (h->context_initialized &&
- (must_reinit || needs_reinit)) {
- if (!h->context_initialized || 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,
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: %d\n", h->width, h->height, h->avctx->pix_fmt);
+ "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) {
av_log(h->avctx, AV_LOG_ERROR,
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) {
+ if (h->poc.frame_num != frame_num) {
+ av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
+ h->poc.frame_num, frame_num);
+ return AVERROR_INVALIDDATA;
+ }
+ }
+
if (!h->setup_finished)
h->poc.frame_num = frame_num;