diff --git a/libavformat/dhav.c b/libavformat/dhav.c index c7e5371636..ffd6d66359 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -237,6 +237,9 @@ static void get_timeinfo(unsigned date, struct tm *timeinfo) static int64_t get_duration(AVFormatContext *s) { + if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) + return 0; + int64_t start_pos = avio_tell(s->pb); int64_t end_pos = -1; int64_t start = 0, end = 0; @@ -248,9 +251,6 @@ static int64_t get_duration(AVFormatContext *s) unsigned date; int64_t size = avio_size(s->pb); - if (!s->pb->seekable) - return 0; - if (start_pos + 16 > size) return 0;