ffmpeg | branch: master | Timo Rothenpieler <t...@rothenpieler.org> | Fri Dec 20 01:26:03 2024 +0100| [741e49c56f1ba4469634633fd4d0e184ccc87219] | committer: Timo Rothenpieler
avformat/flvenc: prevent writing legacy codecs into extended video tracks > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=741e49c56f1ba4469634633fd4d0e184ccc87219 --- libavformat/flvenc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 09a930fb1a..f3f32dc433 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -970,6 +970,15 @@ static int flv_init(struct AVFormatContext *s) switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: + if (video_ctr && + par->codec_id != AV_CODEC_ID_VP8 && + par->codec_id != AV_CODEC_ID_VP9 && + par->codec_id != AV_CODEC_ID_AV1 && + par->codec_id != AV_CODEC_ID_H264 && + par->codec_id != AV_CODEC_ID_HEVC) { + av_log(s, AV_LOG_ERROR, "Unsupported multi-track video codec.\n"); + return AVERROR(EINVAL); + } if (s->streams[i]->avg_frame_rate.den && s->streams[i]->avg_frame_rate.num) { flv->framerate = av_q2d(s->streams[i]->avg_frame_rate); @@ -1012,7 +1021,7 @@ static int flv_init(struct AVFormatContext *s) par->codec_id != AV_CODEC_ID_FLAC && par->codec_id != AV_CODEC_ID_AC3 && par->codec_id != AV_CODEC_ID_EAC3) { - av_log(s, AV_LOG_ERROR, "Unsupported multi-track codec.\n"); + av_log(s, AV_LOG_ERROR, "Unsupported multi-track audio codec.\n"); return AVERROR(EINVAL); } flv->track_idx_map[i] = audio_ctr++; @@ -1390,6 +1399,10 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) write_codec_fourcc(pb, par->codec_id); if (track_idx) avio_w8(pb, track_idx); + } else if (track_idx) { + av_log(s, AV_LOG_ERROR, "Attempted to write legacy codec into extended flv track.\n"); + ret = AVERROR(EINVAL); + goto fail; } else { av_assert1(flags >= 0); avio_w8(pb, flags); _______________________________________________ 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".