From: Michael Niedermayer <[email protected]>

Previously we only wrote the edit list correctly if we had negative
dts but pts == 0 (e.g. for video with B-frames).

This makes sure that audio preroll for e.g. AAC is signaled correctly.
---
 libavformat/movenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6c95b4b..ebdc75c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1628,6 +1628,11 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack 
*track)
             avio_wb32(pb, -1);
         }
         avio_wb32(pb, 0x00010000);
+    } else {
+        // FFMIN is needed due to rounding; dts might actually be a small
+        // positive integer, but rounded to 0 in MOV_TIMESCALE
+        start_ct  = -FFMIN(track->cluster[0].dts, 0);
+        duration += delay;
     }
 
     /* duration */
-- 
1.8.5.2 (Apple Git-48)

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

Reply via email to