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

Git pushed a commit to branch release/7.0
in repository ffmpeg.

commit 9434a8349de3ffd34236ca80df0ca2cf8273681c
Author:     James Almer <[email protected]>
AuthorDate: Fri Feb 27 10:38:14 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Fri Feb 27 12:21:09 2026 -0300

    avformat/mov: fix setting iamf stream id offsets
    
    If we were to add the highest id of a non iamf stream as offset to iamf 
stream
    ids, and one of the latter was 0, then an id overlap would ocurr.
    
    Signed-off-by: James Almer <[email protected]>
    (cherry picked from commit 51aef95ba156b7848eca5445f0f59b091c3b1004)
---
 libavformat/mov.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f2f1bb96e6..b638ca0654 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9553,7 +9553,7 @@ static int mov_parse_tiles(AVFormatContext *s)
 
 static void fix_stream_ids(AVFormatContext *s)
 {
-    int highest_id = 0;
+    int highest_id = 0, lowest_iamf_id = INT_MAX;
 
     for (int i = 0; i < s->nb_streams; i++) {
         const AVStream *st = s->streams[i];
@@ -9561,7 +9561,21 @@ static void fix_stream_ids(AVFormatContext *s)
         if (!sc->iamf)
             highest_id = FFMAX(highest_id, st->id);
     }
-    highest_id += !highest_id;
+
+    for (int i = 0; i < s->nb_stream_groups; i++) {
+        AVStreamGroup *stg = s->stream_groups[i];
+        if (stg->type != AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT)
+            continue;
+        for (int j = 0; j < stg->nb_streams; j++) {
+            AVStream *st = stg->streams[j];
+            lowest_iamf_id = FFMIN(lowest_iamf_id, st->id);
+        }
+    }
+
+    if (highest_id < lowest_iamf_id)
+        return;
+
+    highest_id += !lowest_iamf_id;
     for (int i = 0; highest_id > 1 && i < s->nb_stream_groups; i++) {
         AVStreamGroup *stg = s->stream_groups[i];
         if (stg->type != AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT)

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

Reply via email to