avformat/iamf_writer: check that stream count is consistent for ambisonic Audio Elements

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-12-27 19:11:07 -03:00
parent 21ff60d2cf
commit a0fc454871

View File

@@ -659,8 +659,12 @@ static int ambisonics_config(const IAMFAudioElement *audio_element,
AVIOContext *dyn_bc)
{
const AVIAMFAudioElement *element = audio_element->celement;
const IAMFLayer *ilayer = &audio_element->layers[0];
const AVIAMFLayer *layer = element->layers[0];
if (audio_element->nb_substreams != ilayer->substream_count)
return AVERROR(EINVAL);
ffio_write_leb(dyn_bc, 0); // ambisonics_mode
avio_w8(dyn_bc, layer->ch_layout.nb_channels); // output_channel_count
avio_w8(dyn_bc, audio_element->nb_substreams); // substream_count