[FFmpeg-devel] [PATCH] vp9: error out if chroma subsampling changes between frames.

Ronald S. Bultje rsbultje at gmail.com
Tue May 5 14:03:23 CEST 2015


This can happen after an intra-only frame. For reference, see:
https://groups.google.com/a/webmproject.org/forum/#!msg/webm-discuss/zaoTxREZjq8/v5Enht87AhcJ
---
 libavcodec/vp9.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index c2ac997..2f20097 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -641,7 +641,12 @@ static int decode_frame_header(AVCodecContext *ctx,
                 AVFrame *ref = s->refs[s->refidx[i]].f;
                 int refw = ref->width, refh = ref->height;
 
-                if (refw == w && refh == h) {
+                if (ref->format != fmt) {
+                    av_log(ctx, AV_LOG_ERROR,
+                           "Ref pixfmt (%d) did not match current frame (%d)",
+                           ref->format, fmt);
+                    return AVERROR_INVALIDDATA;
+                } else if (refw == w && refh == h) {
                     s->mvscale[i][0] = s->mvscale[i][1] = 0;
                 } else {
                     if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * refh) {
-- 
2.1.2



More information about the ffmpeg-devel mailing list