summaryrefslogtreecommitdiff
path: root/libavformat/flvdec.c
diff options
context:
space:
mode:
authorKharkov Alexander <kharkovalexander@gmail.com>2011-04-08 16:20:45 +0700
committerMichael Niedermayer <michaelni@gmx.at>2011-04-09 03:23:49 +0200
commitba667e600ffedad9d34caabe13f775b411f33a27 (patch)
tree4dfaca6dba2c0eb476dbdb3aaa84f0b3e956e53f /libavformat/flvdec.c
parentf7f9e24d094c5cde404f4178d81212c91b024022 (diff)
Fix support for flvtool2 "keyframes based" generated index in FLV format decoder
Current keyframes data parser unconditionally rewind metadata to the end at the end of function. As result ALL metadata located after keyframes index not parsed, and as metadata object can have ANY placement inside metadata it can lead to unpredictable result (bitrate can not be found, etc.). As result FLV movie will not play at all in such situation. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r--libavformat/flvdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a63fffdde9..104fc4288d 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -131,6 +131,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
int64_t *times = NULL;
int64_t *filepositions = NULL;
int ret = 0;
+ int64_t initial_pos = url_ftell(ioc);
while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
int64_t** current_array;
@@ -174,7 +175,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
finish:
av_freep(&times);
av_freep(&filepositions);
- avio_seek(ioc, max_pos, SEEK_SET);
+ avio_seek(ioc, initial_pos, SEEK_SET);
return ret;
}