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,
|
| 2142 | 2142 | } while (read_status == AVERROR(EAGAIN)); |
| 2143 | 2143 | if (read_status < 0) |
| 2144 | 2144 | break; |
| 2145 | | av_packet_unref(&pkt); |
| 2146 | 2145 | 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); |
| 2148 | 2148 | break; |
| | 2149 | } |
| 2149 | 2150 | if (nonkey++ > 1000 && st->codec->codec_id != AV_CODEC_ID_CDGRAPHICS) { |
| 2150 | 2151 | 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); |
| 2151 | 2153 | break; |
| 2152 | 2154 | } |
| 2153 | 2155 | } |
| | 2156 | av_packet_unref(&pkt); |
| 2154 | 2157 | } |
| 2155 | 2158 | index = av_index_search_timestamp(st, timestamp, flags); |
| 2156 | 2159 | } |