History

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.

Marton Balint committed 2 years ago

Commit 0aaee471 parent c0a1ce11 file · +5 −2Browse files

Unified · Split

libavformat/mpegts.c+5−2
@@ -1307,8 +1307,11 @@ skip: · 1306 unmodified lines
13071307 p += sl_header_bytes;
13081308 buf_size -= sl_header_bytes;
13091309 }
1310− if (pes->st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV && buf_size >= 5) {
1311− /* skip metadata access unit header */
1310+ if (pes->stream_type == STREAM_TYPE_METADATA &&
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 */
13121315 pes->pes_header_size += 5;
13131316 p += 5;
13141317 buf_size -= 5;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t