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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 76cfcc1692 fftools/ffmpeg_mux_init: don't split forced keyframe spec 
in place
76cfcc1692 is described below

commit 76cfcc1692a39a21f2c651ff965bed260b7cac63
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Thu Jul 30 14:47:03 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Aug 10 20:29:24 2026 +0200

    fftools/ffmpeg_mux_init: don't split forced keyframe spec in place
    
    The spec string is owned by the option list and re-read for every stream
    matching the same -force_key_frames, so terminating entries in place
    truncated it for later streams.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 fftools/ffmpeg_mux_init.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 2a9146e60c..393ed9b668 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -3315,19 +3315,22 @@ static int compare_int64(const void *a, const void *b)
 static int parse_forced_key_frames(void *log, KeyframeForceCtx *kf,
                                    const Muxer *mux, const char *spec)
 {
-    const char *p;
     int n = 1, i, ret, size, index = 0;
     int64_t t, *pts;
 
-    for (p = spec; *p; p++)
+    for (const char *p = spec; *p; p++)
         if (*p == ',')
             n++;
     size = n;
+
+    char *spec_dup = av_strdup(spec);
     pts = av_malloc_array(size, sizeof(*pts));
-    if (!pts)
-        return AVERROR(ENOMEM);
+    if (!spec_dup || !pts) {
+        ret = AVERROR(ENOMEM);
+        goto fail;
+    }
 
-    p = spec;
+    char *p = spec_dup;
     for (i = 0; i < n; i++) {
         char *next = strchr(p, ',');
 
@@ -3345,8 +3348,10 @@ static int parse_forced_key_frames(void *log, 
KeyframeForceCtx *kf,
             }
             size += nb_ch - 1;
             pts = av_realloc_f(pts, size, sizeof(*pts));
-            if (!pts)
-                return AVERROR(ENOMEM);
+            if (!pts) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
 
             if (p[8]) {
                 ret = av_parse_time(&t, p + 8, 1);
@@ -3384,8 +3389,11 @@ static int parse_forced_key_frames(void *log, 
KeyframeForceCtx *kf,
     kf->nb_pts = size;
     kf->pts    = pts;
 
+    av_freep(&spec_dup);
+
     return 0;
 fail:
+    av_freep(&spec_dup);
     av_freep(&pts);
     return ret;
 }

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

Reply via email to