Skip to content

Commit 9da0594

Browse files
committed
avformat/iamfenc: don't write empty packets
And return an error if they are not side data only packets. Signed-off-by: James Almer <jamrial@gmail.com>
1 parent 3423a68 commit 9da0594

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libavformat/iamfenc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,16 @@ static int iamf_write_packet(AVFormatContext *s, AVPacket *pkt)
278278
int dyn_size, type = st->id <= 17 ? st->id + IAMF_OBU_IA_AUDIO_FRAME_ID0 : IAMF_OBU_IA_AUDIO_FRAME;
279279
int ret;
280280

281+
if (!pkt->size) {
282+
uint8_t *new_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, NULL);
283+
284+
if (!new_extradata)
285+
return AVERROR_INVALIDDATA;
286+
287+
// TODO: update FLAC Streaminfo on seekable output
288+
return 0;
289+
}
290+
281291
if (s->nb_stream_groups && st->id == c->first_stream_id) {
282292
AVIAMFParamDefinition *mix =
283293
(AVIAMFParamDefinition *)av_packet_get_side_data(pkt, AV_PKT_DATA_IAMF_MIX_GAIN_PARAM, NULL);

0 commit comments

Comments
 (0)