ffmpeg | branch: release/7.0 | James Almer <jamr...@gmail.com> | Fri Dec 27 
16:17:51 2024 -0300| [c10f15c0e871e1f21f1b4affac1b08ac568785d8] | committer: 
James Almer

avformat/iamf_writer: ensure the stream groups are not empty

Signed-off-by: James Almer <jamr...@gmail.com>
(cherry picked from commit cedd9151f863e3db9c325aff2f9375c39adbbec2)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c10f15c0e871e1f21f1b4affac1b08ac568785d8
---

 libavformat/iamf_writer.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/iamf_writer.c b/libavformat/iamf_writer.c
index b4874806e4..7dfe658bf9 100644
--- a/libavformat/iamf_writer.c
+++ b/libavformat/iamf_writer.c
@@ -217,6 +217,10 @@ int ff_iamf_add_audio_element(IAMFContext *iamf, const 
AVStreamGroup *stg, void
 
     if (stg->type != AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT)
         return AVERROR(EINVAL);
+    if (!stg->nb_streams) {
+        av_log(log_ctx, AV_LOG_ERROR, "Audio Element id %"PRId64" has no 
streams\n", stg->id);
+        return AVERROR(EINVAL);
+    }
 
     iamf_audio_element = stg->params.iamf_audio_element;
     if (iamf_audio_element->audio_element_type == 
AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE) {
@@ -381,6 +385,10 @@ int ff_iamf_add_mix_presentation(IAMFContext *iamf, const 
AVStreamGroup *stg, vo
 
     if (stg->type != AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION)
         return AVERROR(EINVAL);
+    if (!stg->nb_streams) {
+        av_log(log_ctx, AV_LOG_ERROR, "Mix Presentation id %"PRId64" has no 
streams\n", stg->id);
+        return AVERROR(EINVAL);
+    }
 
     for (int i = 0; i < iamf->nb_mix_presentations; i++) {
         if (stg->id == iamf->mix_presentations[i]->mix_presentation_id) {

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to