avformat/iamf_writer: reject unset frame size
The specification states that nb_samples in codec config must not be zero. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -106,12 +106,18 @@ static int populate_audio_roll_distance(IAMFCodecConfig *codec_config)
|
||||
}
|
||||
|
||||
static int fill_codec_config(IAMFContext *iamf, const AVStreamGroup *stg,
|
||||
IAMFCodecConfig *codec_config)
|
||||
IAMFCodecConfig *codec_config, void *log_ctx)
|
||||
{
|
||||
const AVStream *st = stg->streams[0];
|
||||
IAMFCodecConfig **tmp;
|
||||
int j, ret = 0;
|
||||
|
||||
if (!st->codecpar->frame_size) {
|
||||
av_log(log_ctx, AV_LOG_ERROR, "frame_size is unset for stream id %d\n",
|
||||
st->codecpar->codec_id);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
codec_config->codec_id = st->codecpar->codec_id;
|
||||
codec_config->codec_tag = st->codecpar->codec_tag;
|
||||
switch (codec_config->codec_id) {
|
||||
@@ -314,7 +320,7 @@ int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void
|
||||
if (!codec_config)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = fill_codec_config(iamf, stg, codec_config);
|
||||
ret = fill_codec_config(iamf, stg, codec_config, log_ctx);
|
||||
if (ret < 0) {
|
||||
av_free(codec_config);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user