mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
lavf/utils: add error check in av_read_frame()
In particular, fix crash when the input file contains no packets (e.g. an ffmeta input).
This commit is contained in:
parent
127b70e423
commit
64d340c62a
@ -1409,11 +1409,18 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
AVStream *st;
|
||||
|
||||
if (!genpts) {
|
||||
ret = s->packet_buffer ? read_from_packet_buffer(&s->packet_buffer,
|
||||
&s->packet_buffer_end,
|
||||
pkt) :
|
||||
read_frame_internal(s, pkt);
|
||||
goto return_packet;
|
||||
while (1) {
|
||||
ret = s->packet_buffer ?
|
||||
read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt) :
|
||||
read_frame_internal(s, pkt);
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
continue;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
goto return_packet;
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user