avformat/mpegts: update stream info when PMT ES stream_type changes

I have several .ts captures where video and audio codec changes even
though the PMT version does not change and the PIDs stay the same.
This happens during transition to/from slate (mpeg2 video and audio)
to network broadcast (hevc video and eac3 audio in private PES).

I've updated fate ts-demux expected results.
This commit is contained in:
Pavel Koshevoy 2025-05-18 08:57:31 -06:00
parent 20502ba92a
commit 0021484d05
2 changed files with 5 additions and 3 deletions

View file

@ -940,6 +940,8 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
mpegts_find_stream_type(st, pes->stream_type, ISO_types);
if (pes->stream_type == STREAM_TYPE_AUDIO_MPEG2 || pes->stream_type == STREAM_TYPE_AUDIO_AAC)
sti->request_probe = 50;
if (pes->stream_type == STREAM_TYPE_PRIVATE_DATA)
sti->request_probe = AVPROBE_SCORE_STREAM_RETRY;
if ((prog_reg_desc == AV_RL32("HDMV") ||
prog_reg_desc == AV_RL32("HDPR")) &&
st->codecpar->codec_id == AV_CODEC_ID_NONE) {
@ -2508,7 +2510,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (!st)
goto out;
if (pes && !pes->stream_type)
if (pes && pes->stream_type != stream_type)
mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
add_pid_to_program(prg, pid);