Merge commit 'e4eb13ca77624401ea7cef1ed6ad8e2d13fd2063'

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
Derek Buitenhuis 2016-01-27 18:32:28 +00:00
commit e5b5676c00
1 changed files with 13 additions and 11 deletions

View File

@ -989,17 +989,19 @@ skip:
retry_duration: retry_duration:
avio_seek(s->pb, fsize - 4, SEEK_SET); avio_seek(s->pb, fsize - 4, SEEK_SET);
size = avio_rb32(s->pb); size = avio_rb32(s->pb);
// Seek to the start of the last FLV tag at position (fsize - 4 - size) if (size > 0 && size < fsize) {
// but skip the byte indicating the type. // Seek to the start of the last FLV tag at position (fsize - 4 - size)
avio_seek(s->pb, fsize - 3 - size, SEEK_SET); // but skip the byte indicating the type.
if (size == avio_rb24(s->pb) + 11) { avio_seek(s->pb, fsize - 3 - size, SEEK_SET);
uint32_t ts = avio_rb24(s->pb); if (size == avio_rb24(s->pb) + 11) {
ts |= avio_r8(s->pb) << 24; uint32_t ts = avio_rb24(s->pb);
if (ts) ts |= avio_r8(s->pb) << 24;
s->duration = ts * (int64_t)AV_TIME_BASE / 1000; if (ts)
else if (fsize >= 8 && fsize - 8 >= size) { s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
fsize -= size+4; else if (fsize >= 8 && fsize - 8 >= size) {
goto retry_duration; fsize -= size+4;
goto retry_duration;
}
} }
} }