[FFmpeg-cvslog] avformat/iamf_parse: fix setting duration for the last subblock in a parameter definition
James Almer
git at videolan.org
Mon Dec 16 01:42:24 EET 2024
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Dec 11 23:34:32 2024 -0300| [fb5e8ea9719c8afcd0d9e3a51e370c06c361d9ba] | committer: James Almer
avformat/iamf_parse: fix setting duration for the last subblock in a parameter definition
When subblock durations are constant, the last block may be smaller and the
value needs to be calculated.
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fb5e8ea9719c8afcd0d9e3a51e370c06c361d9ba
---
libavformat/iamf_parse.c | 3 ++-
libavformat/iamf_reader.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 00190d87a4..2394536f72 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -539,7 +539,8 @@ static int param_parse(void *s, IAMFContext *c, AVIOContext *pb,
if (constant_subblock_duration == 0) {
subblock_duration = ffio_read_leb(pb);
total_duration += subblock_duration;
- }
+ } else if (i == nb_subblocks - 1)
+ subblock_duration = duration - i * constant_subblock_duration;
switch (type) {
case AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN: {
diff --git a/libavformat/iamf_reader.c b/libavformat/iamf_reader.c
index 7ad61cb246..9f3469b64f 100644
--- a/libavformat/iamf_reader.c
+++ b/libavformat/iamf_reader.c
@@ -178,7 +178,8 @@ static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c,
if (!param_definition->mode && !constant_subblock_duration) {
subblock_duration = ffio_read_leb(pb);
total_duration += subblock_duration;
- }
+ } else if (i == nb_subblocks - 1)
+ subblock_duration = duration - i * constant_subblock_duration;
switch (param->type) {
case AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN: {
More information about the ffmpeg-cvslog
mailing list