diff libmpcodecs/vd_ffmpeg.c @ 36373:3cdf45841125

vd_ffmpeg: catch invalid aspect from FFmpeg. This avoids endless reinitialization with buggy FFmpeg codecs like HEVC that set aspect to be n/0, which compares unequal to itself.
author reimar
date Wed, 16 Oct 2013 17:47:16 +0000
parents 3cc8224f3c6c
children ac6843fb4f01
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Wed Oct 16 17:20:31 2013 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Wed Oct 16 17:47:16 2013 +0000
@@ -568,6 +568,10 @@
 static void update_configuration(sh_video_t *sh, enum AVPixelFormat pix_fmt) {
     vd_ffmpeg_ctx *ctx = sh->context;
     AVCodecContext *avctx = ctx->avctx;
+    if (!avctx->sample_aspect_ratio.den) {
+        mp_msg(MSGT_DECVIDEO, MSGL_WARN, "FFmpeg bug: Invalid aspect\n");
+        avctx->sample_aspect_ratio.den = 1;
+    }
      // it is possible another vo buffers to be used after vo config()
      // lavc reset its buffers on width/heigh change but not on aspect change!!!
     if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) ||