Commit 1347b93c27 for ffmpeg
commit 1347b93c271bf0de1c461d3f0fbad96443821776
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Thu Oct 29 09:01:20 2026 -0500
avformat/oggparsevorbis: ignore comment headers outside a header set
255302da70 and 5a633ec2dd applied the metadata of mid-stream comment
headers for MPD streams. No MPD release sends them: since v0.15, its
encoder starts a new chain with a full header set on tag changes.
A lone comment header is invalid. It is skipped to avoid failing the
stream, but its metadata is not honoured.
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 5a23fc4450..d4df9e234b 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -568,6 +568,12 @@ static int vorbis_packet(AVFormatContext *s, int idx)
}
if (flags & VORBIS_FLAG_COMMENT) {
+ if (!priv->packet[0]) {
+ av_log(s, AV_LOG_WARNING,
+ "Comment header without identification header, ignoring it\n");
+ return 1;
+ }
+
ret = vorbis_update_metadata(s, idx);
if (ret < 0)
return ret;
diff --git a/tests/ref/fate/ogg-vorbis-chained-misplaced-headers b/tests/ref/fate/ogg-vorbis-chained-misplaced-headers
index d4e1e0c085..e8cc320427 100644
--- a/tests/ref/fate/ogg-vorbis-chained-misplaced-headers
+++ b/tests/ref/fate/ogg-vorbis-chained-misplaced-headers
@@ -71,26 +71,26 @@ packet|pts=66496
packet|pts=67520
packet|pts=68544
packet|pts=69568
-packet|pts=70016|tag:title=Ziggy Stardust|tag:artist=The Moog Cookbook|tag:album=The Moog Cookbook Plays The Classic Rock Hits|tag:track=4|side_datum/strings_metadata:side_data_type=Strings Metadata|side_datum/new_extradata:side_data_type=New Extradata
packet|pts=70144
-packet|pts=70720
-packet|pts=71744
-packet|pts=72768
-packet|pts=73792
-packet|pts=74368
+packet|pts=70272
+packet|pts=70848
+packet|pts=71872
+packet|pts=72896
+packet|pts=73920
packet|pts=74496
packet|pts=74624
-packet|pts=75200
-packet|pts=76224
-packet|pts=77248
-packet|pts=78272
-packet|pts=79296
-packet|pts=80320
-packet|pts=81344
-packet|pts=82368
-packet|pts=83392
-packet|pts=84416
-packet|pts=85440
+packet|pts=74752
+packet|pts=75328
+packet|pts=76352
+packet|pts=77376
+packet|pts=78400
+packet|pts=79424
+packet|pts=80448
+packet|pts=81472
+packet|pts=82496
+packet|pts=83520
+packet|pts=84544
+packet|pts=85568
packet|pts=16320
packet|pts=17344
packet|pts=18368
@@ -144,26 +144,26 @@ packet|pts=66496
packet|pts=67520
packet|pts=68544
packet|pts=69568
-packet|pts=70144|tag:title=Ziggy Stardust|tag:artist=The Moog Cookbook|tag:album=The Moog Cookbook Plays The Classic Rock Hits|tag:track=4|side_datum/strings_metadata:side_data_type=Strings Metadata
-packet|pts=70272
-packet|pts=70848
-packet|pts=71872
-packet|pts=72896
-packet|pts=73920
+packet|pts=70016|tag:title=Ziggy Stardust|tag:artist=The Moog Cookbook|tag:album=The Moog Cookbook Plays The Classic Rock Hits|tag:track=4|side_datum/strings_metadata:side_data_type=Strings Metadata|side_datum/new_extradata:side_data_type=New Extradata
+packet|pts=70144
+packet|pts=70720
+packet|pts=71744
+packet|pts=72768
+packet|pts=73792
+packet|pts=74368
packet|pts=74496
packet|pts=74624
-packet|pts=74752
-packet|pts=75328
-packet|pts=76352
-packet|pts=77376
-packet|pts=78400
-packet|pts=79424
-packet|pts=80448
-packet|pts=81472
-packet|pts=82496
-packet|pts=83520
-packet|pts=84544
-packet|pts=85568
+packet|pts=75200
+packet|pts=76224
+packet|pts=77248
+packet|pts=78272
+packet|pts=79296
+packet|pts=80320
+packet|pts=81344
+packet|pts=82368
+packet|pts=83392
+packet|pts=84416
+packet|pts=85440
packet|pts=16320
packet|pts=17344
packet|pts=18368