+ if (avctx->width != width ||
+ avctx->height != height) {
+ if (!frame->key_frame) {
+ av_log(avctx, AV_LOG_ERROR, "Frame size change is unsupported.\n");
+ return AVERROR_INVALIDDATA;
+ }
+ av_frame_unref(s->prev_frame);
+ }
+
+ ret = ff_set_dimensions(avctx, width, height);
+ if (ret < 0)
+ return ret;
+