[FFmpeg-cvslog] lavc/libxvid: workaround for bug in libxvidcore

Lukasz Marek git at videolan.org
Fri Dec 5 03:48:23 CET 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Mon Nov 24 01:12:06 2014 +0100| [4a0b1d924564d7d99254f10fe69aeab5dbef9efa] | committer: Michael Niedermayer

lavc/libxvid: workaround for bug in libxvidcore

libxvidcore calculate number of threads basing on video height.
If height is small enough it allocates 0 bytes long memory and
writes to it.
Setting thread_count to 0 uses 1 thread and skips bugged code.

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a0b1d924564d7d99254f10fe69aeab5dbef9efa
---

 libavcodec/libxvid.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 046d2f7..64572da 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -471,6 +471,19 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
     xvid_enc_create.num_zones = 0;
 
     xvid_enc_create.num_threads = avctx->thread_count;
+#if (XVID_VERSION <= 0x010303) && (XVID_VERSION >= 0x010300)
+    /* workaround for a bug in libxvidcore */
+    if (avctx->height <= 16) {
+        if (avctx->thread_count < 2) {
+            xvid_enc_create.num_threads = 0;
+        } else {
+            av_log(avctx, AV_LOG_ERROR,
+                   "Too small height for threads > 1.");
+            ret = AVERROR(EINVAL);
+            goto fail;
+        }
+    }
+#endif
 
     xvid_enc_create.plugins     = plugins;
     xvid_enc_create.num_plugins = 0;



More information about the ffmpeg-cvslog mailing list