Commit 41ad87ad authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mpegts: improve first valid PMT heuristic

This checks for audio+video instead of streams > 2
Fixes Ticket4090
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 29b1af40
......@@ -2207,7 +2207,12 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
break;
}
if (i == ts->nb_prg && ts->nb_prg > 0) {
if (ts->stream->nb_streams > 1 || pos > 100000) {
int types = 0;
for (i = 0; i < ts->stream->nb_streams; i++) {
AVStream *st = ts->stream->streams[i];
types |= 1<<st->codec->codec_type;
}
if ((types & (1<<AVMEDIA_TYPE_AUDIO) && types & (1<<AVMEDIA_TYPE_VIDEO)) || pos > 100000) {
av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n");
ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment