Decoders supporting frame parameter changes can return delayed frames with the old parameters. --- libavcodec/utils.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1185a35..97fa570 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1282,11 +1282,16 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi else { ret = avctx->codec->decode(avctx, picture, got_picture_ptr, avpkt); - picture->pkt_dts = avpkt->dts; - picture->sample_aspect_ratio = avctx->sample_aspect_ratio; - picture->width = avctx->width; - picture->height = avctx->height; - picture->format = avctx->pix_fmt; + picture->pkt_dts = avpkt->dts; + + /* delayed pictures might have different parameters than + * the context returning them */ + if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { + picture->sample_aspect_ratio = avctx->sample_aspect_ratio; + picture->width = avctx->width; + picture->height = avctx->height; + picture->format = avctx->pix_fmt; + } } emms_c(); //needed to avoid an emms_c() call before every return; -- 1.7.12.4 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel