aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2024-03-01 00:09:43 +0100
committerMarton Balint <cus@passwd.hu>2024-03-04 00:33:20 +0100
commit0aaee4741ce0c10ca09f5d17194b58d0cf0ebece (patch)
tree3f6fcc9264454671734b811f1e72c4abe709ab74 /libavformat
parentc0a1ce1c406be2a70948ace5188aa1fdfdeea556 (diff)
downloadffmpeg-0aaee4741ce0c10ca09f5d17194b58d0cf0ebece.tar.gz
avformat/mpegts: detect synchronous metadata KLV more reliably
The mpegts code historically tries to strip (the first) metadata access unit header from synchronous KLV metadata, but the detection for such streams was unreliable causing strips of asynchronous metadata or ID3 as well. MISB ST 1402 specifies required stream type, stream id and registration descriptor (which eventually maps to the codec ID) so let's use all of these for reliable detection. Fixes a regression caused by 468615f2045da325e0f73e8e668d49cf456ccb37. Fixes ticket #10828, #10883. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 836d5dd5a3..01f6c04223 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1307,8 +1307,11 @@ skip:
p += sl_header_bytes;
buf_size -= sl_header_bytes;
}
- if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) {
- /* skip metadata access unit header */
+ if (pes->stream_type == STREAM_TYPE_METADATA &&
+ pes->stream_id == STREAM_ID_METADATA_STREAM &&
+ pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV &&
+ buf_size >= 5) {
+ /* skip metadata access unit header - see MISB ST 1402 */
pes->pes_header_size += 5;
p += 5;
buf_size -= 5;