Ticket #5117: 0001-avcodec-utils-fix-AVPacket-lifetime-in-seek_frame_ge.patch

File 0001-avcodec-utils-fix-AVPacket-lifetime-in-seek_frame_ge.patch, 1.4 KB (added by Hendrik, 11 years ago)
  • libavformat/utils.c

    From 4267ccb18bb9321e56ccaa3cf33e8ee37ddce1c4 Mon Sep 17 00:00:00 2001
    From: Hendrik Leppkes <h.leppkes@gmail.com>
    Date: Fri, 1 Jan 2016 20:23:37 +0100
    Subject: [PATCH] avcodec/utils: fix AVPacket lifetime in seek_frame_generic
    
    ---
     libavformat/utils.c | 7 +++++--
     1 file changed, 5 insertions(+), 2 deletions(-)
    
    diff --git a/libavformat/utils.c b/libavformat/utils.c
    index 95acbf3..7606502 100644
    a b static int seek_frame_generic(AVFormatContext *s, int stream_index,  
    21422142            } while (read_status == AVERROR(EAGAIN));
    21432143            if (read_status < 0)
    21442144                break;
    2145             av_packet_unref(&pkt);
    21462145            if (stream_index == pkt.stream_index && pkt.dts > timestamp) {
    2147                 if (pkt.flags & AV_PKT_FLAG_KEY)
     2146                if (pkt.flags & AV_PKT_FLAG_KEY) {
     2147                    av_packet_unref(&pkt);
    21482148                    break;
     2149                }
    21492150                if (nonkey++ > 1000 && st->codec->codec_id != AV_CODEC_ID_CDGRAPHICS) {
    21502151                    av_log(s, AV_LOG_ERROR,"seek_frame_generic failed as this stream seems to contain no keyframes after the target timestamp, %d non keyframes found\n", nonkey);
     2152                    av_packet_unref(&pkt);
    21512153                    break;
    21522154                }
    21532155            }
     2156            av_packet_unref(&pkt);
    21542157        }
    21552158        index = av_index_search_timestamp(st, timestamp, flags);
    21562159    }