This should avoid potential small negative offsets due to rounding
error.
---
 libavformat/mux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 4067c16..e4ba209 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -327,7 +327,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
             s->offset_timebase = time_base;
         }
         if (s->offset)
-            offset = av_rescale_q(s->offset, s->offset_timebase, time_base);
+            offset = av_rescale_q_rnd(s->offset, s->offset_timebase, time_base,
+                                      AV_ROUND_UP);
 
         if (pkt->dts != AV_NOPTS_VALUE)
             pkt->dts += offset;
-- 
1.9.3 (Apple Git-50)

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

Reply via email to