If the video stream is disabled (discard set to AVDISCARD_ALL), the code
for adding a seek index entry is skipped. This breaks seeking, and seek
requests will either skip to the start or end of the file.
Fix this by adding the seek entry before skipping the packet.
---
Not sure if this is entirely correct. Why would video index entries
matter for audio-only? Maybe the code should explicitly add index
entries for audio? Anyway, this patch fixes it.
---
libavformat/flvdec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8e4cc5e..748b460 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -818,6 +818,8 @@ skip:
st = create_stream(s, is_audio ? AVMEDIA_TYPE_AUDIO
: AVMEDIA_TYPE_VIDEO);
av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard);
+ if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
+ av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
if ((st->discard >= AVDISCARD_NONKEY &&
!((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||
is_audio)) ||
(st->discard >= AVDISCARD_BIDIR &&
@@ -826,8 +828,6 @@ skip:
avio_seek(s->pb, next, SEEK_SET);
continue;
}
- if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
- av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
break;
}
--
2.0.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel