]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '22522d9c2c69624fe4d81d61ee65a56610f22f1d'
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Jul 2015 21:28:39 +0000 (23:28 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 25 Jul 2015 21:28:39 +0000 (23:28 +0200)
* commit '22522d9c2c69624fe4d81d61ee65a56610f22f1d':
  qsvdec: fix a memleak of async_fifo

Conflicts:
libavcodec/qsvdec.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
1  2 
libavcodec/qsvdec.c

index 37cbb03020d4fea75840289dabf995d10109188b,ef781d9d8edb7041dd891a50fdcdd49133cba4ad..036015f7513e80850e3c4ed10c18375b814ed0cf
@@@ -113,29 -114,6 +113,31 @@@ int ff_qsv_decode_init(AVCodecContext *
          return ff_qsv_error(ret);
      }
  
-     q->async_fifo = av_fifo_alloc((1 + 16) *
-                                   (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));
-     if (!q->async_fifo)
-         return AVERROR(ENOMEM);
 +    avctx->pix_fmt      = AV_PIX_FMT_NV12;
 +    avctx->profile      = param.mfx.CodecProfile;
 +    avctx->level        = param.mfx.CodecLevel;
 +    avctx->coded_width  = param.mfx.FrameInfo.Width;
 +    avctx->coded_height = param.mfx.FrameInfo.Height;
 +    avctx->width        = param.mfx.FrameInfo.CropW - param.mfx.FrameInfo.CropX;
 +    avctx->height       = param.mfx.FrameInfo.CropH - param.mfx.FrameInfo.CropY;
 +
 +    /* maximum decoder latency should be not exceed max DPB size for h.264 and
 +       HEVC which is 16 for both cases.
 +       So weare  pre-allocating fifo big enough for 17 elements:
 +     */
++    if (!q->async_fifo) {
++        q->async_fifo = av_fifo_alloc((1 + 16) *
++                                      (sizeof(mfxSyncPoint) + sizeof(QSVFrame*)));
++        if (!q->async_fifo)
++            return AVERROR(ENOMEM);
++    }
 +
 +    q->input_fifo = av_fifo_alloc(1024*16);
 +    if (!q->input_fifo)
 +        return AVERROR(ENOMEM);
 +
 +    q->engine_ready = 1;
 +
      return 0;
  }