[FFmpeg-trac] #9082(avcodec:open): Memory leak while trancoding on GPU

FFmpeg trac at avcodec.org
Tue Jun 15 20:04:14 EEST 2021


#9082: Memory leak while trancoding on GPU
-------------------------------------+-------------------------------------
             Reporter:  misko        |                    Owner:  (none)
                 Type:  defect       |                   Status:  open
             Priority:  important    |                Component:  avcodec
              Version:  git-master   |               Resolution:
             Keywords:  cuda         |               Blocked By:
  regression                         |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by James):

 Can you test the following?

 {{{
 diff --git a/libavcodec/decode.c b/libavcodec/decode.c
 index 75bc7ad98e..ed49d14fab 100644
 --- a/libavcodec/decode.c
 +++ b/libavcodec/decode.c
 @@ -533,6 +533,11 @@ static int
 decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
      if (ret == AVERROR_EOF)
          avci->draining_done = 1;

 +    if (IS_EMPTY(avci->last_pkt_props)
 +        && av_fifo_size(avctx->internal->pkt_props) >=
 sizeof(*avci->last_pkt_props))
 +        av_fifo_generic_read(avctx->internal->pkt_props,
 +                             avci->last_pkt_props,
 sizeof(*avci->last_pkt_props), NULL);
 +
      if (!ret) {
          frame->best_effort_timestamp = guess_correct_pts(avctx,
                                                           frame->pts,
 @@ -1490,10 +1495,6 @@ int ff_decode_frame_props(AVCodecContext *avctx,
 AVFrame *frame)
          { AV_PKT_DATA_S12M_TIMECODE,
 AV_FRAME_DATA_S12M_TIMECODE },
      };

 -    if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >=
 sizeof(*pkt))
 -        av_fifo_generic_read(avctx->internal->pkt_props,
 -                             pkt, sizeof(*pkt), NULL);
 -
      frame->pts = pkt->pts;
      frame->pkt_pos      = pkt->pos;
      frame->pkt_duration = pkt->duration;
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9082#comment:20>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list