diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index 1a43727a30..d76963a1c7 100644 --- a/libavcodec/sheervideo.c +++ b/libavcodec/sheervideo.c @@ -2036,17 +2036,18 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } + if (s->format != format) { + if (ret < 0) { + s->format = 0; + return ret; + } + s->format = format; + } if (avpkt->size < 20 + avctx->width * avctx->height / 16) { av_log(avctx, AV_LOG_ERROR, "Input packet too small\n"); return AVERROR_INVALIDDATA; } - if (s->format != format) { - if (ret < 0) - return ret; - s->format = format; - } - p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1;