On Sun, 23 Nov 2014, Uwe L. Korn wrote:

---
libavformat/flvdec.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2d5e50e..e235c55 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -845,9 +845,13 @@ skip:
    if (s->pb->seekable && (!s->duration || s->duration == AV_NOPTS_VALUE)) {
        int size;
        const int64_t pos   = avio_tell(s->pb);
+        // Read the last 4 bytes of the file, this should be the size of the
+        // previous FLV tag. Use the timestamp of its payload as duration.
        const int64_t fsize = avio_size(s->pb);
        avio_seek(s->pb, fsize - 4, SEEK_SET);
        size = avio_rb32(s->pb);
+        // Seek to the previous FLV tag at position (fsize - 4 - size) but skip
+        // the byte indicating the type.

I'd rather use "Seek to the start of the last FLV tag" instead of talking about "the previous" - when we've already been talking about this packet, talking about "previous" sounds like the next-to-last packet to me.

Other than that, ok with me.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to