aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmi Fischman <fischman@chromium.org>2011-06-29 13:54:49 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2011-06-29 15:27:55 -0700
commit5dd514af937ff4d74c3c263e4ca428b14b62d5f1 (patch)
tree07c749dfc78303f5235fdf0f926145bb225e0b8f
parent59ca3955fbe13401bf49d456562264267d9991fe (diff)
downloadffmpeg-5dd514af937ff4d74c3c263e4ca428b14b62d5f1.tar.gz
matroskadec: forward parsing errors to caller.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
-rw-r--r--libavformat/matroskadec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 57a8f624b8..c5f8e673dc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1623,7 +1623,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
if (size <= 3 || !track || !track->stream) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %"PRIu64" or size %u\n", num, size);
- return res;
+ return AVERROR_INVALIDDATA;
}
st = track->stream;
if (st->discard >= AVDISCARD_ALL)
@@ -1860,7 +1860,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
res = ebml_parse(matroska, matroska_clusters, &cluster);
blocks_list = &cluster.blocks;
blocks = blocks_list->elem;
- for (i=0; i<blocks_list->nb_elem; i++)
+ for (i=0; i<blocks_list->nb_elem && !res; i++)
if (blocks[i].bin.size > 0 && blocks[i].bin.data) {
int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
if (!blocks[i].non_simple)
@@ -1879,14 +1879,15 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
{
MatroskaDemuxContext *matroska = s->priv_data;
+ int ret = 0;
- while (matroska_deliver_packet(matroska, pkt)) {
+ while (!ret && matroska_deliver_packet(matroska, pkt)) {
if (matroska->done)
return AVERROR_EOF;
- matroska_parse_cluster(matroska);
+ ret = matroska_parse_cluster(matroska);
}
- return 0;
+ return ret;
}
static int matroska_read_seek(AVFormatContext *s, int stream_index,