[FFmpeg-cvslog] libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.

Romain Beauxis git at videolan.org
Wed Jun 21 03:08:46 EEST 2023


ffmpeg | branch: master | Romain Beauxis <toots at rastageeks.org> | Tue Jun 20 00:09:33 2023 -0500| [468615f2045da325e0f73e8e668d49cf456ccb37] | committer: James Almer

libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.

Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams
in mpegts (commit 4a4437c0fbc8f7afe0c533070395a42e56b4ee75), AV_CODEC_ID_SMPTE_KLV
was the only existing codec for metadata.

It seems that this codec has a 5-bytes metadata header[1] that, for some reason,
was always skipped when decoding data packets.

However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the
5 first bytes of the payload being cut-off, which includes essential informations
such as the ID3 tag version.

This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV
streams.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=468615f2045da325e0f73e8e668d49cf456ccb37
---

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

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



More information about the ffmpeg-cvslog mailing list