aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-09-24 00:33:15 +0200
committerStefano Sabatini <stefasab@gmail.com>2012-09-24 00:41:13 +0200
commit64d340c62ad5954c1a834df2d26057135e771774 (patch)
tree743d8f2a196ca82595a3f6e3c377f24789facfa9
parent127b70e423407a65a2c92fcbbc1db7263af3e0eb (diff)
downloadffmpeg-64d340c62ad5954c1a834df2d26057135e771774.tar.gz
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).
-rw-r--r--libavformat/utils.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6603483e64..4f3529aff4 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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 (;;) {