[FFmpeg-devel] [PATCH] avformat/mpegts: Restrict skipping Metadata AU cells to metadata streams

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Mar 1 23:11:04 EET 2024


Only metadata streams (stream type 0x15) are packed
in Metadata AU cells, so it should only be stripped
from them and not from all KLV streams.

Fixes ticket #10828, a regression since
468615f2045da325e0f73e8e668d49cf456ccb37.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
I really don't know mpegts; the above information is based
around reading ITU-T H.222.0 for about half an hour.

 libavformat/mpegts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 836d5dd5a3..7c40e52262 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1307,7 +1307,8 @@ skip:
                     p += sl_header_bytes;
                     buf_size -= sl_header_bytes;
                 }
-                if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) {
+                if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV &&
+                    pes->stream_type == 0x15 && buf_size >= 5) {
                     /* skip metadata access unit header */
                     pes->pes_header_size += 5;
                     p += 5;
-- 
2.40.1



More information about the ffmpeg-devel mailing list