Fixes crashes when muxing video tracks alongside IAMF ones. Signed-off-by: James Almer <jamr...@gmail.com> --- libavformat/movenc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index ae49582a1a..87ec368d52 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -7536,6 +7536,7 @@ static int mov_init_iamf_track(AVFormatContext *s) if (!track->iamf) return AVERROR(ENOMEM); + track->first_iamf_idx = INT_MAX; for (int i = 0; i < s->nb_stream_groups; i++) { const AVStreamGroup *stg = s->stream_groups[i]; switch(stg->type) { @@ -7558,6 +7559,11 @@ static int mov_init_iamf_track(AVFormatContext *s) return ret; } + if (track->first_iamf_idx != 0) { + av_log(s, AV_LOG_ERROR, "The IMAF track must be the first track\n"); + return AVERROR(EINVAL);; + } + track->tag = MKTAG('i','a','m','f'); ret = avio_open_dyn_buf(&track->iamf_buf); @@ -7830,8 +7836,11 @@ static int mov_init(AVFormatContext *s) for (int j = 0, i = 0; j < s->nb_streams; j++) { AVStream *st = s->streams[j]; - if (st != st->priv_data) + if (st != st->priv_data) { + if (!i) + i++; // IAMF track is the first one continue; + } st->priv_data = &mov->tracks[i++]; } -- 2.45.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".