This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit dab1ac3e6e91b67c68eb397f3ea12ecc97fa8706
Author:     Marton Balint <[email protected]>
AuthorDate: Mon Jun 15 23:17:09 2026 +0200
Commit:     Marton Balint <[email protected]>
CommitDate: Wed Jun 24 23:31:53 2026 +0200

    avformat/utils: fix ff_dict_set_timestamp() with negative timestamps
    
    Signed-off-by: Marton Balint <[email protected]>
---
 libavformat/utils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 64b9b898e6..c64ff27418 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -609,14 +609,15 @@ int ff_bprint_to_codecpar_extradata(AVCodecParameters 
*par, struct AVBPrint *buf
 
 int ff_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t 
timestamp)
 {
-    time_t seconds = timestamp / 1000000;
+    int microsecs = timestamp % 1000000;
+    time_t seconds = timestamp / 1000000 - (microsecs < 0);
     struct tm *ptm, tmbuf;
     ptm = gmtime_r(&seconds, &tmbuf);
     if (ptm) {
         char buf[32];
         if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm))
             return AVERROR_EXTERNAL;
-        av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000));
+        av_strlcatf(buf, sizeof(buf), ".%06dZ", microsecs + (microsecs < 0) * 
1000000);
         return av_dict_set(dict, key, buf, 0);
     } else {
         return AVERROR_EXTERNAL;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to