Browse code

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>

Kharkov Alexander authored on 2011/04/08 18:20:45
Showing 1 changed files
... ...
@@ -131,6 +131,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
131 131
     int64_t *times = NULL;
132 132
     int64_t *filepositions = NULL;
133 133
     int ret = 0;
134
+    int64_t initial_pos = url_ftell(ioc);
134 135
 
135 136
     while (avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
136 137
         int64_t** current_array;
... ...
@@ -174,7 +175,7 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, AVStream
174 174
 finish:
175 175
     av_freep(&times);
176 176
     av_freep(&filepositions);
177
-    avio_seek(ioc, max_pos, SEEK_SET);
177
+    avio_seek(ioc, initial_pos, SEEK_SET);
178 178
     return ret;
179 179
 }
180 180