Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bf1c87ee7ab1b98c1b92172eb1ebd6ad55564ff7)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -1634,7 +1634,7 @@ static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx, |
1634 | 1634 |
const ReadInterval *interval, int64_t *cur_ts) |
1635 | 1635 |
{ |
1636 | 1636 |
AVPacket pkt, pkt1; |
1637 |
- AVFrame frame; |
|
1637 |
+ AVFrame *frame = NULL; |
|
1638 | 1638 |
int ret = 0, i = 0, frame_count = 0; |
1639 | 1639 |
int64_t start = -INT64_MAX, end = interval->end; |
1640 | 1640 |
int has_start = 0, has_end = interval->has_end && !interval->end_is_offset; |
... | ... |
@@ -1668,6 +1668,7 @@ static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx, |
1668 | 1668 |
} |
1669 | 1669 |
} |
1670 | 1670 |
|
1671 |
+ frame = av_frame_alloc(); |
|
1671 | 1672 |
while (!av_read_frame(fmt_ctx, &pkt)) { |
1672 | 1673 |
if (selected_streams[pkt.stream_index]) { |
1673 | 1674 |
AVRational tb = fmt_ctx->streams[pkt.stream_index]->time_base; |
... | ... |
@@ -1700,7 +1701,7 @@ static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx, |
1700 | 1700 |
} |
1701 | 1701 |
if (do_read_frames) { |
1702 | 1702 |
pkt1 = pkt; |
1703 |
- while (pkt1.size && process_frame(w, fmt_ctx, &frame, &pkt1) > 0); |
|
1703 |
+ while (pkt1.size && process_frame(w, fmt_ctx, frame, &pkt1) > 0); |
|
1704 | 1704 |
} |
1705 | 1705 |
} |
1706 | 1706 |
av_free_packet(&pkt); |
... | ... |
@@ -1712,10 +1713,11 @@ static int read_interval_packets(WriterContext *w, AVFormatContext *fmt_ctx, |
1712 | 1712 |
for (i = 0; i < fmt_ctx->nb_streams; i++) { |
1713 | 1713 |
pkt.stream_index = i; |
1714 | 1714 |
if (do_read_frames) |
1715 |
- while (process_frame(w, fmt_ctx, &frame, &pkt) > 0); |
|
1715 |
+ while (process_frame(w, fmt_ctx, frame, &pkt) > 0); |
|
1716 | 1716 |
} |
1717 | 1717 |
|
1718 | 1718 |
end: |
1719 |
+ av_frame_free(&frame); |
|
1719 | 1720 |
if (ret < 0) { |
1720 | 1721 |
av_log(NULL, AV_LOG_ERROR, "Could not read packets in interval "); |
1721 | 1722 |
log_read_interval(interval, NULL, AV_LOG_ERROR); |