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.
Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -1307,8 +1307,11 @@ skip: · 1306 unmodified lines | |||
| 1307 | p += sl_header_bytes; | 1307 | p += sl_header_bytes; |
| 1308 | buf_size -= sl_header_bytes; | 1308 | buf_size -= sl_header_bytes; |
| 1309 | } | 1309 | } |
| 1310 | if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) { | 1310 | if (pes->stream_type == STREAM_TYPE_METADATA && |
| 1311 | /* skip metadata access unit header */ | 1311 | pes->stream_id == STREAM_ID_METADATA_STREAM && |
| 1312 | pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && | ||
| 1313 | buf_size >= 5) { | ||
| 1314 | /* skip metadata access unit header - see MISB ST 1402 */ | ||
| 1312 | pes->pes_header_size += 5; | 1315 | pes->pes_header_size += 5; |
| 1313 | p += 5; | 1316 | p += 5; |
| 1314 | buf_size -= 5; | 1317 | buf_size -= 5; |