mpevideo_enc: disallow multiple slices for h261 and flv

Message ID 20151120083445.0390A5DA9D@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau Nov. 20, 2015, 8:34 a.m.
Module: libav
Branch: master
Commit: d80f0a4ad634b3949b91b85f21fd608c0cddeef7

Author:    Anton Khirnov <anton@khirnov.net>
Committer: Anton Khirnov <anton@khirnov.net>
Date:      Wed Nov 18 10:32:34 2015 +0100

mpevideo_enc: disallow multiple slices for h261 and flv

They do not work and produce corrupted output.

CC: libav-stable@libav.org

---

 libavcodec/mpegvideo_enc.c |    6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ab4fb32..d572b85 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -496,6 +496,12 @@  FF_ENABLE_DEPRECATION_WARNINGS
         }
     }
 
+    if (avctx->slices > 1 &&
+        (avctx->codec_id == AV_CODEC_ID_FLV1 || avctx->codec_id == AV_CODEC_ID_H261)) {
+        av_log(avctx, AV_LOG_ERROR, "Multiple slices are not supported by this codec\n");
+        return AVERROR(EINVAL);
+    }
+
     if (s->avctx->thread_count > 1         &&
         s->codec_id != AV_CODEC_ID_MPEG4      &&
         s->codec_id != AV_CODEC_ID_MPEG1VIDEO &&