mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-21 13:21:55 +08:00
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 <jamrial@gmail.com>
(cherry picked from commit 51aef95ba1)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user